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

Add BAL balance opcode #226

Merged
merged 6 commits into from
Nov 27, 2021
Merged

Add BAL balance opcode #226

merged 6 commits into from
Nov 27, 2021

Conversation

wolflo
Copy link
Contributor

@wolflo wolflo commented Nov 23, 2021

Address #225.

  • The order of the color and contract ID operands feel a little backwards from the TR and TRO opcodes. But this seems to make more sense if we want to add a SELFBAL opcode in the future for getting the balance of the current contract ID, where we would just drop the contract ID argument.
  • There's some complexity around balances and contract outputs I haven't wrapped my head around yet, so might be missing something here.

@wolflo wolflo requested a review from adlerjohn November 23, 2021 18:21
@adlerjohn adlerjohn linked an issue Nov 23, 2021 that may be closed by this pull request
@adlerjohn adlerjohn added the comp:FVM Component: FuelVM label Nov 23, 2021
Copy link
Contributor

@adlerjohn adlerjohn left a comment

Choose a reason for hiding this comment

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

One small formatting change. The specification looks fine!

specs/vm/opcodes.md Outdated Show resolved Hide resolved
@adlerjohn adlerjohn requested review from vlopes11 and sezna November 23, 2021 22:22
specs/vm/opcodes.md Outdated Show resolved Hide resolved
adlerjohn
adlerjohn previously approved these changes Nov 24, 2021
Copy link
Contributor

@adlerjohn adlerjohn left a comment

Choose a reason for hiding this comment

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

I'm fine with it as-is, but can you make an issue to track fixing possible inconsistent use of balance and balanceOf?

@wolflo
Copy link
Contributor Author

wolflo commented Nov 25, 2021

Should also probably update with the new details about panic reasons added to the rest of the opcodes in #227.

specs/vm/opcodes.md Outdated Show resolved Hide resolved
@wolflo
Copy link
Contributor Author

wolflo commented Nov 26, 2021

Does the color need to be in tx.inputs in some form too?

@adlerjohn
Copy link
Contributor

Does the color need to be in tx.inputs in some form too?

No, because it's getting the balance of a colored coin for a contract, of any color.

@wolflo wolflo merged commit 07478a5 into master Nov 27, 2021
@wolflo wolflo deleted the wolflo/bal-opcode branch November 27, 2021 01:59
vlopes11 added a commit to FuelLabs/fuel-asm that referenced this pull request Nov 30, 2021
vlopes11 added a commit to FuelLabs/fuel-asm that referenced this pull request Dec 1, 2021
vlopes11 added a commit to FuelLabs/fuel-vm that referenced this pull request Dec 4, 2021
The opcode implementation brings the ability to inspect the balance of a
given color+contract tuple.

This allows the test case `mint_burn` to be moved to the integrated
scope since before this opcode, there was no way to fetch the balance of
the tuple without inspecting the internals of the interpreter.

Follows FuelLabs/fuel-specs#226
vlopes11 added a commit to FuelLabs/fuel-vm that referenced this pull request Dec 4, 2021
The opcode implementation brings the ability to inspect the balance of a
given color+contract tuple.

This allows the test case `mint_burn` to be moved to the integrated
scope since before this opcode, there was no way to fetch the balance of
the tuple without inspecting the internals of the interpreter.

Follows FuelLabs/fuel-specs#226
ControlCplusControlV pushed a commit to FuelLabs/fuel-vm that referenced this pull request Dec 1, 2022
xgreenx pushed a commit to FuelLabs/fuel-vm that referenced this pull request Dec 20, 2022
xgreenx pushed a commit to FuelLabs/fuel-vm that referenced this pull request Dec 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comp:FVM Component: FuelVM
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add balance instruction
3 participants