[beta] Backporting (#6675)
* Required validators >= num owners (#6551) * Debounce sync status. (#6572) * Fixed network protocol version negotiation * Renamed RPC receipt statusCode field to status * Fixed RETURNDATA size for built-ins
This commit is contained in:
parent
67bd9a33cf
commit
2d4f4bdd61
@ -412,13 +412,19 @@ impl<'a, B: 'a + StateBackend, E: Engine + ?Sized> Executive<'a, B, E> {
|
||||
|
||||
let cost = builtin.cost(data);
|
||||
if cost <= params.gas {
|
||||
if let Err(e) = builtin.execute(data, &mut output) {
|
||||
let mut builtin_out_buffer = Vec::new();
|
||||
let result = {
|
||||
let mut builtin_output = BytesRef::Flexible(&mut builtin_out_buffer);
|
||||
builtin.execute(data, &mut builtin_output)
|
||||
};
|
||||
if let Err(e) = result {
|
||||
self.state.revert_to_checkpoint();
|
||||
let evm_err: evm::evm::Error = e.into();
|
||||
tracer.trace_failed_call(trace_info, vec![], evm_err.clone().into());
|
||||
Err(evm_err)
|
||||
} else {
|
||||
self.state.discard_checkpoint();
|
||||
output.write(0, &builtin_out_buffer);
|
||||
|
||||
// trace only top level calls to builtins to avoid DDoS attacks
|
||||
if self.depth == 0 {
|
||||
@ -435,9 +441,10 @@ impl<'a, B: 'a + StateBackend, E: Engine + ?Sized> Executive<'a, B, E> {
|
||||
);
|
||||
}
|
||||
|
||||
let out_len = builtin_out_buffer.len();
|
||||
Ok(FinalizationResult {
|
||||
gas_left: params.gas - cost,
|
||||
return_data: ReturnData::new(output.to_owned(), 0, output.len()),
|
||||
return_data: ReturnData::new(builtin_out_buffer, 0, out_len),
|
||||
apply_state: true,
|
||||
})
|
||||
}
|
||||
|
36
js/package-lock.json
generated
36
js/package-lock.json
generated
@ -9,6 +9,16 @@
|
||||
"resolved": "https://registry.npmjs.org/@parity/wordlist/-/wordlist-1.0.1.tgz",
|
||||
"integrity": "sha1-wn5A4as2OKCe1TtKLoHVMbXrWjE="
|
||||
},
|
||||
"JSONStream": {
|
||||
"version": "0.8.4",
|
||||
"resolved": "https://registry.npmjs.org/JSONStream/-/JSONStream-0.8.4.tgz",
|
||||
"integrity": "sha1-kWV9/m/4V0gwZhMrRhi2Lo9Ih70=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"jsonparse": "0.0.5",
|
||||
"through": "2.3.8"
|
||||
}
|
||||
},
|
||||
"abab": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/abab/-/abab-1.0.3.tgz",
|
||||
@ -7154,16 +7164,6 @@
|
||||
"integrity": "sha1-T9kss04OnbPInIYi7PUfm5eMbLk=",
|
||||
"dev": true
|
||||
},
|
||||
"JSONStream": {
|
||||
"version": "0.8.4",
|
||||
"resolved": "https://registry.npmjs.org/JSONStream/-/JSONStream-0.8.4.tgz",
|
||||
"integrity": "sha1-kWV9/m/4V0gwZhMrRhi2Lo9Ih70=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"jsonparse": "0.0.5",
|
||||
"through": "2.3.8"
|
||||
}
|
||||
},
|
||||
"jsprim": {
|
||||
"version": "1.4.1",
|
||||
"resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz",
|
||||
@ -11649,14 +11649,6 @@
|
||||
"resolved": "https://registry.npmjs.org/strict-uri-encode/-/strict-uri-encode-1.1.0.tgz",
|
||||
"integrity": "sha1-J5siXfHVgrH1TmWt3UNS4Y+qBxM="
|
||||
},
|
||||
"string_decoder": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.3.tgz",
|
||||
"integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==",
|
||||
"requires": {
|
||||
"safe-buffer": "5.1.1"
|
||||
}
|
||||
},
|
||||
"string-width": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz",
|
||||
@ -11672,6 +11664,14 @@
|
||||
"resolved": "https://registry.npmjs.org/string.prototype.repeat/-/string.prototype.repeat-0.2.0.tgz",
|
||||
"integrity": "sha1-q6Nt4I3O5qWjN9SbLqHaGyj8Ds8="
|
||||
},
|
||||
"string_decoder": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.3.tgz",
|
||||
"integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==",
|
||||
"requires": {
|
||||
"safe-buffer": "5.1.1"
|
||||
}
|
||||
},
|
||||
"stringify-object": {
|
||||
"version": "3.2.0",
|
||||
"resolved": "https://registry.npmjs.org/stringify-object/-/stringify-object-3.2.0.tgz",
|
||||
|
@ -281,6 +281,12 @@ export default class CreateWalletStore {
|
||||
const daylimitValidation = validateUint(_wallet.daylimit);
|
||||
const nameValidation = validateName(_wallet.name);
|
||||
|
||||
const owners = _wallet.owners.filter((owner) => !/^(0x)?0*$/.test(owner));
|
||||
|
||||
if (_wallet.required > owners.length) {
|
||||
requiredValidation.valueError = 'the number of required validators should be lower or equal the number of owners';
|
||||
}
|
||||
|
||||
const errors = {
|
||||
address: addressValidation.addressError,
|
||||
account: accountValidation.addressError,
|
||||
|
@ -14,7 +14,7 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import { isEqual } from 'lodash';
|
||||
import { isEqual, debounce } from 'lodash';
|
||||
|
||||
import { LOG_KEYS, getLogger } from '~/config';
|
||||
import UpgradeStore from '~/modals/UpgradeParity/store';
|
||||
@ -179,6 +179,12 @@ export default class Status {
|
||||
});
|
||||
}
|
||||
|
||||
_updateStatus = debounce(status => {
|
||||
this._store.dispatch(statusCollection(status));
|
||||
}, 2500, {
|
||||
maxWait: 5000
|
||||
});
|
||||
|
||||
_subscribeEthSyncing = () => {
|
||||
return this._api.pubsub
|
||||
.eth
|
||||
@ -187,7 +193,7 @@ export default class Status {
|
||||
return;
|
||||
}
|
||||
|
||||
this._store.dispatch(statusCollection({ syncing }));
|
||||
this._updateStatus({ syncing });
|
||||
});
|
||||
}
|
||||
|
||||
@ -198,6 +204,7 @@ export default class Status {
|
||||
if (error || !netPeers) {
|
||||
return;
|
||||
}
|
||||
|
||||
this._store.dispatch(statusCollection({ netPeers }));
|
||||
});
|
||||
}
|
||||
|
@ -1019,7 +1019,7 @@ fn rpc_eth_transaction_receipt() {
|
||||
"params": ["0xb903239f8543d04b5dc1ba6579132b143087c68db1b2168786408fcbce568238"],
|
||||
"id": 1
|
||||
}"#;
|
||||
let response = r#"{"jsonrpc":"2.0","result":{"blockHash":"0xed76641c68a1c641aee09a94b3b471f4dc0316efe5ac19cf488e2674cf8d05b5","blockNumber":"0x4510c","contractAddress":null,"cumulativeGasUsed":"0x20","gasUsed":"0x10","logs":[{"address":"0x33990122638b9132ca29c723bdf037f1a891a70c","blockHash":"0xed76641c68a1c641aee09a94b3b471f4dc0316efe5ac19cf488e2674cf8d05b5","blockNumber":"0x4510c","data":"0x","logIndex":"0x1","topics":["0xa6697e974e6a320f454390be03f74955e8978f1a6971ea6730542e37b66179bc","0x4861736852656700000000000000000000000000000000000000000000000000"],"transactionHash":"0x0000000000000000000000000000000000000000000000000000000000000000","transactionIndex":"0x0","transactionLogIndex":"0x0","type":"mined"}],"logsBloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","root":"0x0000000000000000000000000000000000000000000000000000000000000000","statusCode":null,"transactionHash":"0x0000000000000000000000000000000000000000000000000000000000000000","transactionIndex":"0x0"},"id":1}"#;
|
||||
let response = r#"{"jsonrpc":"2.0","result":{"blockHash":"0xed76641c68a1c641aee09a94b3b471f4dc0316efe5ac19cf488e2674cf8d05b5","blockNumber":"0x4510c","contractAddress":null,"cumulativeGasUsed":"0x20","gasUsed":"0x10","logs":[{"address":"0x33990122638b9132ca29c723bdf037f1a891a70c","blockHash":"0xed76641c68a1c641aee09a94b3b471f4dc0316efe5ac19cf488e2674cf8d05b5","blockNumber":"0x4510c","data":"0x","logIndex":"0x1","topics":["0xa6697e974e6a320f454390be03f74955e8978f1a6971ea6730542e37b66179bc","0x4861736852656700000000000000000000000000000000000000000000000000"],"transactionHash":"0x0000000000000000000000000000000000000000000000000000000000000000","transactionIndex":"0x0","transactionLogIndex":"0x0","type":"mined"}],"logsBloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","root":"0x0000000000000000000000000000000000000000000000000000000000000000","status":null,"transactionHash":"0x0000000000000000000000000000000000000000000000000000000000000000","transactionIndex":"0x0"},"id":1}"#;
|
||||
|
||||
assert_eq!(tester.io.handle_request_sync(request), Some(response.to_owned()));
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ pub struct Receipt {
|
||||
#[serde(rename="logsBloom")]
|
||||
pub logs_bloom: H2048,
|
||||
/// Status code
|
||||
#[serde(rename="statusCode")]
|
||||
#[serde(rename="status")]
|
||||
pub status_code: Option<u8>,
|
||||
}
|
||||
|
||||
@ -131,7 +131,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn receipt_serialization() {
|
||||
let s = r#"{"transactionHash":"0x0000000000000000000000000000000000000000000000000000000000000000","transactionIndex":"0x0","blockHash":"0xed76641c68a1c641aee09a94b3b471f4dc0316efe5ac19cf488e2674cf8d05b5","blockNumber":"0x4510c","cumulativeGasUsed":"0x20","gasUsed":"0x10","contractAddress":null,"logs":[{"address":"0x33990122638b9132ca29c723bdf037f1a891a70c","topics":["0xa6697e974e6a320f454390be03f74955e8978f1a6971ea6730542e37b66179bc","0x4861736852656700000000000000000000000000000000000000000000000000"],"data":"0x","blockHash":"0xed76641c68a1c641aee09a94b3b471f4dc0316efe5ac19cf488e2674cf8d05b5","blockNumber":"0x4510c","transactionHash":"0x0000000000000000000000000000000000000000000000000000000000000000","transactionIndex":"0x0","logIndex":"0x1","transactionLogIndex":null,"type":"mined"}],"root":"0x000000000000000000000000000000000000000000000000000000000000000a","logsBloom":"0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f","statusCode":null}"#;
|
||||
let s = r#"{"transactionHash":"0x0000000000000000000000000000000000000000000000000000000000000000","transactionIndex":"0x0","blockHash":"0xed76641c68a1c641aee09a94b3b471f4dc0316efe5ac19cf488e2674cf8d05b5","blockNumber":"0x4510c","cumulativeGasUsed":"0x20","gasUsed":"0x10","contractAddress":null,"logs":[{"address":"0x33990122638b9132ca29c723bdf037f1a891a70c","topics":["0xa6697e974e6a320f454390be03f74955e8978f1a6971ea6730542e37b66179bc","0x4861736852656700000000000000000000000000000000000000000000000000"],"data":"0x","blockHash":"0xed76641c68a1c641aee09a94b3b471f4dc0316efe5ac19cf488e2674cf8d05b5","blockNumber":"0x4510c","transactionHash":"0x0000000000000000000000000000000000000000000000000000000000000000","transactionIndex":"0x0","logIndex":"0x1","transactionLogIndex":null,"type":"mined"}],"root":"0x000000000000000000000000000000000000000000000000000000000000000a","logsBloom":"0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f","status":null}"#;
|
||||
|
||||
let receipt = Receipt {
|
||||
transaction_hash: Some(0.into()),
|
||||
|
@ -511,6 +511,7 @@ impl Session {
|
||||
i += 1;
|
||||
}
|
||||
debug!(target: "network", "Hello: {} v{} {} {:?}", client_version, protocol, id, caps);
|
||||
let protocol = ::std::cmp::min(protocol, host.protocol_version);
|
||||
self.info.protocol_version = protocol;
|
||||
self.info.client_version = client_version;
|
||||
self.info.capabilities = caps;
|
||||
|
Loading…
Reference in New Issue
Block a user