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] add access list tx #4391

Merged
merged 2 commits into from
Sep 13, 2024
Merged

[action] add access list tx #4391

merged 2 commits into from
Sep 13, 2024

Conversation

dustinxie
Copy link
Member

Description

  1. add legacy and access list tx
  2. ignore the first commit, which is a clean-up

Fixes #(issue)

Type of change

Please delete options that are not relevant.

  • [] Bug fix (non-breaking change which fixes an issue)
  • [] New feature (non-breaking change which adds functionality)
  • [] Code refactor or improvement
  • [] Breaking change (fix or feature that would cause a new or changed behavior of existing functionality)
  • [] This change requires a documentation update

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

  • [] make test
  • [] fullsync
  • [] Other test (please specify)

Test Configuration:

  • Firmware version:
  • Hardware:
  • Toolchain:
  • SDK:

Checklist:

  • [] My code follows the style guidelines of this project
  • [] I have performed a self-review of my code
  • [] I have commented my code, particularly in hard-to-understand areas
  • [] I have made corresponding changes to the documentation
  • [] My changes generate no new warnings
  • [] I have added tests that prove my fix is effective or that my feature works
  • [] New and existing unit tests pass locally with my changes
  • [] Any dependent changes have been merged and published in downstream modules

Copy link

codecov bot commented Sep 12, 2024

Codecov Report

Attention: Patch coverage is 79.35780% with 45 lines in your changes missing coverage. Please review.

Project coverage is 75.28%. Comparing base (36f0d99) to head (bfea850).
Report is 23 commits behind head on master.

Files with missing lines Patch % Lines
action/tx_access_list.go 75.60% 16 Missing and 4 partials ⚠️
action/envelope.go 68.29% 13 Missing ⚠️
action/tx_legacy.go 81.81% 8 Missing and 2 partials ⚠️
action/builder.go 88.88% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4391      +/-   ##
==========================================
- Coverage   75.86%   75.28%   -0.58%     
==========================================
  Files         361      371      +10     
  Lines       30116    30280     +164     
==========================================
- Hits        22846    22795      -51     
- Misses       6134     6323     +189     
- Partials     1136     1162      +26     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -79,23 +79,24 @@ func (b *Builder) Build() AbstractAction {
// TODO: change envelope to *envelope
type EnvelopeBuilder struct {
elp envelope
ab AbstractAction
Copy link
Member

Choose a reason for hiding this comment

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

If you want to keep the interface of EnvelopeBuilder as unchanged as possible to reduce modifications, it would be more suitable to change it to LegacyEnvelopeBuilder. The new EnvelopeBuilder may only need SetCommon() and SetPayload().

Copy link
Member Author

Choose a reason for hiding this comment

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

  1. the current builder is more intuitive and easier to understand/use: SetNonce().SetGasPrice().SetGasLimit()...
  2. SetCommon() and SetPayload() would cause too many code changes

}

func (elp *envelope) BlobTxSidecar() *types.BlobTxSidecar {
// TODO
return nil
return elp.common.BlobTxSidecar()
}

func (elp *envelope) Value() *big.Int {
Copy link
Member

Choose a reason for hiding this comment

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

why not return common.Value?

Copy link
Member Author

Choose a reason for hiding this comment

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

so far only EVM would use Value()

r.Equal("0801100818e907220231332803", hex.EncodeToString(b))
pb := iotextypes.ActionCore{}
r.NoError(proto.Unmarshal(b, &pb))
r.Equal(tx, MustNoErrorV(fromProtoLegacyTx(&pb)))
Copy link
Collaborator

Choose a reason for hiding this comment

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

expect fromProtoLegacyTx(&pb) == tx

Copy link
Member Author

Choose a reason for hiding this comment

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

yes, this is L35 doing, tx == the result of fromProtoLegacyTx(&pb)

"github.com/pkg/errors"
)

type LegacyTx struct {
Copy link
Collaborator

Choose a reason for hiding this comment

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

comment

Copy link
Member Author

Choose a reason for hiding this comment

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

fixed


func (tx *LegacyTx) toProto() *iotextypes.ActionCore {
actCore := iotextypes.ActionCore{
Version: 1,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

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

fixed


func (tx *AccessListTx) toProto() *iotextypes.ActionCore {
actCore := iotextypes.ActionCore{
Version: 1,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Version AccessListTxType

Copy link
Member Author

Choose a reason for hiding this comment

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

fixed

"github.com/pkg/errors"
)

type AccessListTx struct {
Copy link
Collaborator

Choose a reason for hiding this comment

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

comment

Copy link
Member Author

Choose a reason for hiding this comment

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

fixed

"rawAmount": "0",
"rawGasLimit": 1000000,
"rawGasPrice": "0",
"rawAccessList": [
Copy link
Member Author

Choose a reason for hiding this comment

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

add test with valid access list

Copy link
Collaborator

@CoderZhi CoderZhi left a comment

Choose a reason for hiding this comment

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

let's refactor builder in a follow up PR

Copy link

sonarcloud bot commented Sep 13, 2024

@dustinxie dustinxie merged commit 7a8a9fe into master Sep 13, 2024
3 checks passed
@dustinxie dustinxie deleted the addtx branch September 13, 2024 17:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants