-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good stuff! LGTM but let's wait for CI.
Co-Authored-By: David <dvdplm@gmail.com>
Co-Authored-By: David <dvdplm@gmail.com>
…o adria0/fix/tests
e0cf12a
to
6575ebc
Compare
Co-authored-by: Niklas Adolfsson <niklasadolfsson1@gmail.com>
Co-authored-by: Niklas Adolfsson <niklasadolfsson1@gmail.com>
ethcore/machine/src/executive.rs
Outdated
// EIP161 - reverted calls cancels state trie cleaning | ||
if initial_builtin_balance.is_zero() { | ||
let prune = UNPRUNABLE_PRECOMPILE_ADDRESS | ||
.map_or(true, |addr| addr != params.code_address); | ||
if prune { | ||
substate.touched.remove(¶ms.code_address); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just to make sure I understand this correctly: for tests this will remove all but ripemd builtints with zero balance and for production this revert all zero-balanced builtins (although in practice all builtins have balance: 1
, maybe there are some exceptions https://github.com/openethereum/openethereum/pull/11482/files#r378702588, this needs to be double checked)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a great observation, classic
and foundation
have balance == 0
more might have it too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for tests this will remove all but ripemd builtints with zero balance
we need to be able to reproduce the RIPEMD removal at block #2686351
in tests
for production this revert all zero-balanced builtins
afaik, all precompiles has balance: 1
due the EIP161 rule. for instance, when you create a new clique genesis with geth, all precompiles balances are set to 1
maybe there are some exceptions
this issue happened due that both geth and parity allowed the removal of 0x3 account for different reasons, and nobody noticed about it after some time, so core devs decided to introduce this "irregular state transition".
I agree with you that this change could affect to PoA chains with the same scenario:
- they initially specified the precompile in the trie with
balance=0
- they called a precompile without enough gas and the precompile reverted and was removed from the trie
Maybe we can add there a eip161_touch_prunning_bug
, but this is really ugly 😱
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moving everything to chain definitions is another option,
eip161_unprunable_precompiles
: list of precompile addresses that cannot be pruned if touched with zero balance in a reverted call.
we have to add this flag to the testnet with 0x3
, and also allows fixing existing PoA chains. I think that we need to generate some kind of an explicit warn!
log there to help to identity the problem.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see these options now:
- (a) Fix EIP161 only in tests: in real deployments, this is "tactically fixed" by setting balances to >=1 in precompile accounts.
- (b) Fix EIP161 at all
- (b.1) add a chain option
eip161_unprunable_precompiles=addr, addr,...
and define it in mainnet chains with 0x3 - (b.2) add a chain option
eip161_touch_prunning_bug
, a flag that could be activated by any existing PoA chains that removed some precompile accounts
- (b.1) add a chain option
- (c) Introduce generic irregular state transitions (I do not like this)
Any other idea? Thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would go for option (a) as the easiest one, but we would need to ensure (somehow via CI and document it enough) that each precompile has balance >= 1 indeed. The problem with changing balance for existing chains is that it's a breaking change (see e.g. #11108).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ordian, implemented (a) in this PR, commit openethereum/openethereum@04dc267
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall this looks good (great actually). I have a doubt about the "legacy" tests: unless we have a compelling reason for keeping them I am not sure they are worth keeping. Do you think you can expand the description with a motivation why?
ethcore/res/ethereum/test-specs/byzantium_to_constantinoplefixat5_test.json
Outdated
Show resolved
Hide resolved
ethcore/res/ethereum/test-specs/eip158_to_byzantiumat5_test.json
Outdated
Show resolved
Hide resolved
I know this isn't a fair comparison but I ran Master:
This branch:
(This does not include build times; I ran both commands twice.) |
Co-authored-by: David <dvdplm@gmail.com>
Absolutely aware of it. It's horrible how compilation+test times are growing :( We need a better strategy than adding and adding more tests. Removing legacy ones for the "normal" builds is an option. |
please merge with master (just merged #11675 which updated the submodule) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's get this merged. Awesome job @adria0 🍰
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very good job looks good modulo some style nits in ethcore/src/json_tests/chain.rs
.
- Make sure that your editor removes trailing whitespaces
- Function calls/function definitions should have a space between for example
fn foo(a: usize, b: usize)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great job!
* master: Adria0/fix/tests (#11597)
Issue for this PR is https://github.com/openethereum/openethereum/issues/11647
Fixing/syncing #11085
[json-tests] run all tests (or justify why not)
with the last available ethereum/tests@5841af6