Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

Fix light sync with initial validator-set contract #8528

Merged
merged 4 commits into from
May 15, 2018
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ethcore/src/spec/spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -785,7 +785,7 @@ impl Spec {
let tx = Transaction {
nonce: self.engine.account_start_nonce(0),
action: Action::Call(a),
gas: U256::from(50_000_000), // TODO: share with client.
gas: U256::default(),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doesn't seem right to provide no gas. then no work will be done and we will almost certainly end up in the wrong state. 50M is an arbitrary amount but we could also set to U256::max_value -- the key thing is really that the env_info's gas limit is at least the amount of gas provided to the transaction, which seems to be the failure here.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think for genesis_epoch_data, the goal is to get an initial list of validators. when the ValidatorSet is a contract, we have to call a function on that contract to extract the validators. This function needs some gas to read out the validators from storage, allocated memory for them, and ABI-encode the return data.

The thought process I've been following so far with ValidatorSet contracts is that supplying infinite gas is fine because the contract is actually part of the consensus process and shouldn't be subject to the metering rules or have an escape-hatch from turing-completeness. The same should apply here.

gas_price: U256::default(),
value: U256::default(),
data: d,
Expand Down