Skip to content
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] simplify TxCommon interface #4496

Merged
merged 1 commit into from
Nov 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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 action/envelope.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ type (
Nonce() uint64
Gas() uint64
GasPrice() *big.Int
EffectiveGasPrice(*big.Int) *big.Int
TxDynamicGas
AccessList() types.AccessList
TxBlob
Expand All @@ -71,6 +70,7 @@ type (
TxDynamicGas interface {
GasTipCap() *big.Int
GasFeeCap() *big.Int
EffectiveGasPrice(*big.Int) *big.Int
Copy link
Member Author

Choose a reason for hiding this comment

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

more natural to put the func in TxDynamicGas

}

TxBlob interface {
Expand Down
2 changes: 1 addition & 1 deletion action/protocol/protocol.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ func SplitGas(ctx context.Context, tx action.TxDynamicGas, usedGas uint64) (*big
return priority.Mul(priority, gas), base.Mul(base, gas), nil
}

func EffectiveGasPrice(ctx context.Context, tx action.TxCommon) *big.Int {
func EffectiveGasPrice(ctx context.Context, tx action.TxDynamicGas) *big.Int {
if !MustGetFeatureCtx(ctx).EnableDynamicFeeTx {
return nil
}
Expand Down
6 changes: 3 additions & 3 deletions action/protocol/rewarding/protocol.go
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ func (p *Protocol) deleteStateV2(sm protocol.StateManager, key []byte) error {
func (p *Protocol) settleSystemAction(
ctx context.Context,
sm protocol.StateManager,
act action.TxCommon,
act action.TxDynamicGas,
Copy link
Member Author

Choose a reason for hiding this comment

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

#4396 extends this interface to TxCommon, with this change, we can reduce it back to TxDynamicGas

status uint64,
si int,
logs []*action.Log,
Expand All @@ -399,7 +399,7 @@ func (p *Protocol) settleSystemAction(
func (p *Protocol) settleUserAction(
ctx context.Context,
sm protocol.StateManager,
act action.TxCommon,
act action.TxDynamicGas,
status uint64,
si int,
logs []*action.Log,
Expand All @@ -411,7 +411,7 @@ func (p *Protocol) settleUserAction(
func (p *Protocol) settleAction(
ctx context.Context,
sm protocol.StateManager,
act action.TxCommon,
act action.TxDynamicGas,
status uint64,
si int,
isSystemAction bool,
Expand Down
2 changes: 1 addition & 1 deletion action/protocol/staking/protocol.go
Original file line number Diff line number Diff line change
Expand Up @@ -689,7 +689,7 @@ const (
func (p *Protocol) settleAction(
ctx context.Context,
sm protocol.StateManager,
act action.TxCommon,
act action.TxDynamicGas,
status uint64,
logs []*action.Log,
tLogs []*action.TransactionLog,
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ require (
lukechampine.com/blake3 v1.2.1 // indirect
)

//TODO: add tag for go-ethereum
//Note: add tag for go-ethereum before cutting hard-fork release
replace github.com/ethereum/go-ethereum => github.com/iotexproject/go-ethereum v0.5.0

replace golang.org/x/xerrors => golang.org/x/xerrors v0.0.0-20190212162355-a5947ffaace3
14 changes: 14 additions & 0 deletions test/mock/mock_envelope/mock_envelope.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading