-
Notifications
You must be signed in to change notification settings - Fork 325
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[action] enable dynamic fee tx #4393
Conversation
// ====================================== | ||
// utility funcs to convert native action to eth tx | ||
// ====================================== | ||
func toLegacyEthTx(ab TxCommon, act Action) (*types.Transaction, error) { |
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.
moved to envelope.ToEthTx()
iotextypes.Encoding_ETHEREUM_DYNAMICFEE, | ||
nil, | ||
"0dd507264fcc092c6430c248e48ac525e334e3699852e44451a376c4744e09af", | ||
}, |
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.
test case for access list and dynamic fee tx
action/rlp_tx_test.go
Outdated
GasFeeCap: big.NewInt(1045), | ||
}) | ||
_, _, _, err = ExtractTypeSigPubkey(tx) | ||
require.ErrorIs(err, ErrNotSupported) |
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.
these tx types are supported now, so the test become obsolete
action/sealedenvelope.go
Outdated
@@ -83,7 +84,8 @@ func (sealed *SealedEnvelope) calcHash() (hash.Hash256, error) { | |||
return hash.ZeroHash256, ErrInvalidAct | |||
} | |||
return act.hash(), nil | |||
case iotextypes.Encoding_ETHEREUM_EIP155, iotextypes.Encoding_ETHEREUM_UNPROTECTED: | |||
case iotextypes.Encoding_ETHEREUM_EIP155, iotextypes.Encoding_ETHEREUM_UNPROTECTED, iotextypes.Encoding_ETHEREUM_ACCESSLIST, |
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.
may use Encoding_ETHEREUM_EIP155
to representing tx with eth-format
fallthrough | ||
case encoding == iotextypes.Encoding_ETHEREUM_EIP155 || encoding == iotextypes.Encoding_ETHEREUM_UNPROTECTED: | ||
return toLegacyEthTx(elp.common, elp.Action()) | ||
tx, ok := elp.Action().(EthCompatibleAction) |
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.
Add ToEthTx(to, data)
to EthCompatibleAction
, and the corresponding types will handle their own conversion logics by calling return tx.ToEthTx(to, data)
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.
corresponding types -- do you mean elp.Action() = transfer, execution, staking
? or the 4 types of actions elp.common = legacy, accesslist, dynamicfee, blob
?
now the data are split into 2 parts:
elp.Action()
provides 3 fieldsValue, To, Data
elp.common
provides other fields likeNonce, Gas, AccessList
, etc
so here the code is getting 3 fields from elp.Action()
, and add to elp.common
to construct the return tx
action/envelope.go
Outdated
@@ -217,58 +218,12 @@ func (elp *envelope) Action() Action { return elp.payload } | |||
|
|||
// ToEthTx converts to Ethereum tx | |||
func (elp *envelope) ToEthTx(evmNetworkID uint32, encoding iotextypes.Encoding) (*types.Transaction, error) { | |||
tx, ok := elp.Action().(EthCompatibleAction) | |||
act, ok := elp.Action().(EthCompatibleAction) |
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.
still have putpullresult
does not implement this, so for now this check is still needed
can remove this in another PR if we decide to implement EthCompatibleAction
for putpullresult
action/envelope.go
Outdated
return nil, errors.Wrapf(ErrInvalidAct, "unsupported type = %v", common.Version()) | ||
} | ||
return types.NewTx(txdata), nil | ||
return elp.common.toEthTx(act) |
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.
to, err := act.EthTo()
if err != nil {
return nil, err
}
data, err := act.EthData()
if err != nil {
return nil, err
}
return elp.common.toEthTx(to, data, act.Value())
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.
changed to this
Quality Gate failedFailed conditions |
Description
Please include a summary of the changes and the related issue. Please also include relevant motivation and context. List any dependencies that are required for this change.
Fixes #(issue)
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
Test Configuration:
Checklist: