-
Notifications
You must be signed in to change notification settings - Fork 1.7k
backwards compatible call_type creation_method #11450
Conversation
* master: rlp_derive: cleanup (#11446)
How should we test this change? Do you have a step-by-step recipe? |
@fleupold Can you take a look at this please? |
the #11427 was reverted in e188f47 and it shouldn't be reviewed (or the reversion can be extracted into a separate PR) To test this
There are some unit tests as well 8aca13b |
})) | ||
} | ||
} | ||
|
||
/// Description of a _call_ action, either a `CALL` operation or a message transaction. | ||
#[derive(Debug, Clone, PartialEq, RlpEncodable, RlpDecodable)] | ||
pub struct Call { |
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.
What do you think about annotating that data of this type end up rlp-ized in the database and thus any changes need to be made backwards compatibly?
@@ -113,6 +242,9 @@ pub struct Create { | |||
pub gas: U256, | |||
/// The init code. | |||
pub init: Bytes, | |||
/// Creation method (CREATE vs CREATE2). |
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 think we should add a not to the docs for this type that data of this type ends up in the database and so great care is necessary when making changes.
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'm very sorry for merging the #11311 in a bad state. I originally had backwards compatibility in mind and tested specifically for that. I didn't rerun the test plan after the last set of changes, which was very bad.
Generally I'm wondering if it's worth all this hassle in order to change an enum<None, a, b, ...>
to an Option<enum<a, b, ...>>
type. Aren't they semantically the same?
@@ -240,8 +244,6 @@ impl From<trace::Create> for Create { | |||
#[derive(Debug, Serialize)] | |||
#[serde(rename_all = "lowercase")] | |||
pub enum CallType { | |||
/// None | |||
None, |
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.
Since all the trouble is coming from killing this variant here, would it maybe be better to leave the None type on the enum directly? Does it make much of a difference to have an enum with 5 variants vs a nested enum (Option where some has 4 variants)?
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.
The difference is that Option<CallType>
and CallType
from 2.6 have different rlp serialization layout, the former is a list, and the latter is serialized as an int. If we want to be backwards compatible with both 2.6 and 2.7.0, we need to be able to deserialize both versions to the same struct.
ethcore/trace/src/types/trace.rs
Outdated
impl Decodable for CallType { | ||
fn decode(rlp: &Rlp) -> Result<Self, DecoderError> { | ||
rlp.as_val().and_then(|v| Ok(match v { | ||
0u32 => CallType::Call, |
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.
Is this correct? In the old version, when we serialized a 0 this meant CallType::None, but it will now be read to CallType::Call. Shouldn't this all be shifted by 1?
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.
Option<CallType>
is serialized as list https://github.com/paritytech/parity-common/blob/a8329435e19d46b3e50145a9b5a399bfac52a31f/rlp/src/impls.rs#L70-L99 and I assume that #11311 was reviewed properly, so we don't have to re-review it again 😅
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.
Actually, I think you're right, let me test this again.
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.
lgtm!
@@ -130,7 +130,7 @@ impl From<ethjson::vm::Transaction> for ActionParams { | |||
gas: t.gas.into(), | |||
gas_price: t.gas_price.into(), | |||
value: ActionValue::Transfer(t.value.into()), | |||
call_type: match address.is_zero() { true => CallType::None, false => CallType::Call }, // TODO @debris is this correct? | |||
action_type: ActionType::Call, |
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.
Doesn't that change the JSON tests results?
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 haven't touched that code, so I assume it was reviewed
#11311 (comment)
Works here. :) |
* rlp_derive: update syn & co * rlp_derive: remove dummy_const * rlp_derive: remove unused attirubutes * rlp-derive: change authors * rlp_derive: add rlp(default) attribute * Revert "Revert "[Trace] Distinguish between `create` and `create2` (#11311)" (#11427)" This reverts commit 5d4993b. * trace: backwards compatible call_type and creation_method * trace: add rlp backward compatibility tests * cleanup * i know, i hate backwards compatibility too * address review grumbles
* update classic testnet bootnodes (#11398) * update classic testnet bootnodes * Update kotti.json * Update kotti.json * Update kotti.json * Update mordor.json * verification: fix race same block + misc (#11400) * ethcore: fix race in verification * verification: fix some nits * verification: refactor err type `Kind::create` * fix: tests * address grumbles * address grumbles: don't panic * fix: export hardcoded sync format (#11416) * fix: export hardcoded sync format * address grumbles * make tests compile with rustc_hex 2.0 * fix grumbles: impl LowerHex for encoded Header * goerli: replace foundation bootnode (#11433) * Remove dead bootnodes, add new geth bootnodes (#11441) * update kvdb-rocksdb to 0.4 (#11442) * Avoid long state queries when serving GetNodeData requests (#11444) * Remove dead bootnodes, add new geth bootnodes * More granular locking when fetching state Finish GetDataNode requests early if queries take too long * typo * Use latest kvdb-rocksdb * Cleanup * Update ethcore/sync/src/chain/supplier.rs Co-Authored-By: Andronik Ordian <write@reusable.software> * Address review grumbles * Fix compilation * Address review grumbles Co-authored-by: Andronik Ordian <write@reusable.software> * rlp_derive: cleanup (#11446) * rlp_derive: update syn & co * rlp_derive: remove dummy_const * rlp_derive: remove unused attirubutes * rlp-derive: change authors * Cargo.lock: cargo update -p kvdb-rocksdb (#11447) * Cargo.lock: new lockfile format Manual backport of #11448 * gcc to clang (#11453) * gcc to clang test ``` export CC="sccache "$CC export CXX="sccache "$CXX ``` darwin build ``` CC=clang CXX=clang ``` * darwin - > default clang * Bump version and CHANGELOG.md * chore: remove unused dependencies (#11432) * fix: compiler warnings * chore: remove unused dependencies * Update CHANGELOG.md * update Cargo.lock * update CHANGELOG.md * backwards compatible call_type creation_method (#11450) * rlp_derive: update syn & co * rlp_derive: remove dummy_const * rlp_derive: remove unused attirubutes * rlp-derive: change authors * rlp_derive: add rlp(default) attribute * Revert "Revert "[Trace] Distinguish between `create` and `create2` (#11311)" (#11427)" This reverts commit 5d4993b. * trace: backwards compatible call_type and creation_method * trace: add rlp backward compatibility tests * cleanup * i know, i hate backwards compatibility too * address review grumbles * update CHANGELOG.md * just to make sure we don't screw up this again (#11455) * Update CHANGELOG.md Co-authored-by: Talha Cross <47772477+soc1c@users.noreply.github.com> Co-authored-by: Niklas Adolfsson <niklasadolfsson1@gmail.com> Co-authored-by: Martin Holst Swende <martin@swende.se> Co-authored-by: David <dvdplm@gmail.com> Co-authored-by: Andronik Ordian <write@reusable.software> Co-authored-by: Denis S. Soldatov aka General-Beck <general.beck@gmail.com>
…pstream * master: upgrade some of the dependencies (#11467) Some more release track changes to README.md (#11465) Update simple one-line installer due to switching to a single stable release track (#11463) update Dockerfile (#11461) Implement EIP-2124 (#11456) [eth classic chainspec]: remove `balance = 1` (#11459) just to make sure we don't screw up this again (#11455) backwards compatible call_type creation_method (#11450) gcc to clang (#11453) Avoid copies (#11451) Cargo.lock: cargo lock translate (#11448)
on top of #11449
this should allow having tracing nodes db synced with 2.6 and 2.7