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

[FVM] beyond EVM part 2.2 - adding EVM emulator #4927

Merged
merged 28 commits into from
Nov 7, 2023

Conversation

ramtinms
Copy link
Contributor

@ramtinms ramtinms commented Nov 2, 2023

The second part of this large PR

@ramtinms ramtinms marked this pull request as draft November 2, 2023 18:09
@ramtinms ramtinms removed the request for review from janezpodhostnik November 2, 2023 18:38
@ramtinms ramtinms changed the title [FVM] beyond EVM part 2.2 - adding EVM emulator database [FVM] beyond EVM part 2.2 - adding EVM emulator Nov 2, 2023
@ramtinms ramtinms marked this pull request as ready for review November 2, 2023 20:49
@ramtinms ramtinms requested a review from fxamacker November 3, 2023 18:17
fvm/evm/types/errors.go Outdated Show resolved Hide resolved
fvm/evm/emulator/emulator.go Outdated Show resolved Hide resolved
fvm/evm/emulator/emulator_test.go Outdated Show resolved Hide resolved
CanTransfer: core.CanTransfer,
Transfer: core.Transfer,
GasLimit: BlockLevelGasLimit, // block gas limit
BaseFee: big.NewInt(0), //
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
BaseFee: big.NewInt(0), //
BaseFee: big.NewInt(0),

// check source balance
// if balance is lower than amount return
if proc.state.GetBalance(addr).Cmp(amount) == -1 {
return res, types.ErrInsufficientBalance
Copy link
Contributor

Choose a reason for hiding this comment

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

shouldn't this be a fatal error for this specific case?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

why fatal? this means the user didn't have enough balance in it's account to withdraw from.

Copy link
Contributor

Choose a reason for hiding this comment

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

sorry missed the cmp method, you are right.

Base automatically changed from ramtin/evm-adding-emulator-database to master November 6, 2023 21:16
@codecov-commenter
Copy link

codecov-commenter commented Nov 6, 2023

Codecov Report

Attention: 155 lines in your changes are missing coverage. Please review.

Comparison is base (d13d4be) 55.75% compared to head (cda7ba4) 49.29%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4927      +/-   ##
==========================================
- Coverage   55.75%   49.29%   -6.47%     
==========================================
  Files         955      428     -527     
  Lines       88883    37762   -51121     
==========================================
- Hits        49557    18613   -30944     
+ Misses      35589    17762   -17827     
+ Partials     3737     1387    -2350     
Flag Coverage Δ
unittests 49.29% <57.30%> (-6.47%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
fvm/evm/emulator/database/database.go 57.70% <100.00%> (+0.18%) ⬆️
fvm/evm/emulator/signer.go 100.00% <100.00%> (ø)
fvm/evm/types/address.go 0.00% <ø> (ø)
fvm/evm/types/emulator.go 0.00% <ø> (ø)
fvm/evm/types/result.go 0.00% <ø> (ø)
fvm/evm/types/errors.go 9.09% <0.00%> (-2.68%) ⬇️
fvm/evm/emulator/emulator.go 83.75% <83.75%> (ø)
fvm/evm/emulator/config.go 46.47% <46.47%> (ø)
fvm/evm/types/call.go 0.00% <0.00%> (ø)

... and 535 files with indirect coverage changes

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


// create account if not exist
if !proc.state.Exist(addr) {
proc.state.CreateAccount(addr)
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think this is needed, add a balance call below will create a new object if it doesn't exist. I can understand tho if you wanted to make it super clear.

Copy link
Contributor Author

@ramtinms ramtinms Nov 7, 2023

Choose a reason for hiding this comment

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

I think add balance would create the object if not exist, not the account :-?

Copy link
Contributor

@sideninja sideninja left a comment

Choose a reason for hiding this comment

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

Left comments but nothing major

@ramtinms ramtinms enabled auto-merge November 7, 2023 16:36
@ramtinms ramtinms added this pull request to the merge queue Nov 7, 2023
Merged via the queue into master with commit 417ec4a Nov 7, 2023
36 checks passed
@ramtinms ramtinms deleted the ramtin/evm-adding-emulator branch November 7, 2023 19:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants