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

doc: refine the transaction example in the README #2072

Merged
merged 4 commits into from
Aug 19, 2024

Conversation

mmyyrroonn
Copy link
Contributor

I tried the command in the readme and met the following errors during my work

thread 'main' panicked at bin/fuel-core-client/src/main.rs:52:50:
invalid transaction json: Error("missing field `script`", line: 1, column: 133)
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

I replaced it with the tx from the test file below by using the function to_json()

fuel-core/tests/tests/tx.rs

Lines 155 to 172 in a9e5e89

let script = [
op::addi(0x10, RegId::ZERO, 0xca),
op::addi(0x11, RegId::ZERO, 0xba),
op::log(0x10, 0x11, RegId::ZERO, RegId::ZERO),
op::ret(RegId::ONE),
];
let script: Vec<u8> = script
.iter()
.flat_map(|op| u32::from(*op).to_be_bytes())
.collect();
let tx = TransactionBuilder::script(script, vec![])
.script_gas_limit(gas_limit)
.maturity(maturity)
.add_random_fee_input()
.finalize_as_transaction();
client.submit_and_await_commit(&tx).await.unwrap();

@CLAassistant
Copy link

CLAassistant commented Aug 13, 2024

CLA assistant check
All committers have signed the CLA.

@MitchTurner
Copy link
Member

Thanks for the contribution!

Interesting. I actually get a different error:

thread 'main' panicked at bin/fuel-core-client/src/main.rs:52:50:
invalid transaction json: Error("unrecognized named flag `GasPrice`", line: 1, column: 67)
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

However, your change still makes it valid :)

@mmyyrroonn
Copy link
Contributor Author

Thanks for the contribution!

Interesting. I actually get a different error:

thread 'main' panicked at bin/fuel-core-client/src/main.rs:52:50:
invalid transaction json: Error("unrecognized named flag `GasPrice`", line: 1, column: 67)
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

However, your change still makes it valid :)

Yes. You're correct. That's the first error message I met. I changed it to the MaxFee and will meet more errors. I just pick one error message to demonstrate the problem. 😄 I assume the example is out-of-date due to the quick development.

@netrome
Copy link
Contributor

netrome commented Aug 14, 2024

Thanks for the contribution!
Interesting. I actually get a different error:

thread 'main' panicked at bin/fuel-core-client/src/main.rs:52:50:
invalid transaction json: Error("unrecognized named flag `GasPrice`", line: 1, column: 67)
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

However, your change still makes it valid :)

Yes. You're correct. That's the first error message I met. I changed it to the MaxFee and will meet more errors. I just pick one error message to demonstrate the problem. 😄 I assume the example is out-of-date due to the quick development.

Nice! I've also tried this now. The updated transaction seems to be valid, but trying to add it to the chain results in the error Transaction is not inserted. UTXO does not exist when running fuel core with ./target/debug/fuel-core run --db-type in-memory. The UTXO validation can be turned off by adding the --debug flag, hence running ./target/debug/fuel-core run --db-type in-memory --debug.

@mmyyrroonn while you're at it, can you add a line to the cURL example explaining to run the node with ./target/debug/fuel-core run --db-type in-memory --debug for the example to be accepted by the node?

@mmyyrroonn
Copy link
Contributor Author

Thanks for the contribution!
Interesting. I actually get a different error:

thread 'main' panicked at bin/fuel-core-client/src/main.rs:52:50:
invalid transaction json: Error("unrecognized named flag `GasPrice`", line: 1, column: 67)
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

However, your change still makes it valid :)

Yes. You're correct. That's the first error message I met. I changed it to the MaxFee and will meet more errors. I just pick one error message to demonstrate the problem. 😄 I assume the example is out-of-date due to the quick development.

Nice! I've also tried this now. The updated transaction seems to be valid, but trying to add it to the chain results in the error Transaction is not inserted. UTXO does not exist when running fuel core with ./target/debug/fuel-core run --db-type in-memory. The UTXO validation can be turned off by adding the --debug flag, hence running ./target/debug/fuel-core run --db-type in-memory --debug.

@mmyyrroonn while you're at it, can you add a line to the cURL example explaining to run the node with ./target/debug/fuel-core run --db-type in-memory --debug for the example to be accepted by the node?

It's a good suggestion. I added one sentence to demonstrate the --debug flag. It's working successfully right now. 😄

@Dentosal
Copy link
Member

Related: #1669

@mmyyrroonn
Copy link
Contributor Author

Should I add a change log for this PR? 😄

@netrome
Copy link
Contributor

netrome commented Aug 19, 2024

Should I add a change log for this PR? 😄

I don't think this needs a change log (@MitchTurner please correct me if I'm mistaken), so you can add the no-changelog label.

@mmyyrroonn
Copy link
Contributor Author

Should I add a change log for this PR? 😄

I don't think this needs a change log (@MitchTurner please correct me if I'm mistaken), so you can add the no-changelog label.

That's cool. However, it seems that I cannot modify the label of this PR.

@netrome netrome added the no changelog Skip the CI check of the changelog modification label Aug 19, 2024
@netrome
Copy link
Contributor

netrome commented Aug 19, 2024

That's cool. However, it seems that I cannot modify the label of this PR.

Makes sense, thanks for highlighting. I've added the label for you now instead.

@netrome netrome enabled auto-merge (squash) August 19, 2024 09:11
@netrome netrome merged commit 2aa3463 into FuelLabs:master Aug 19, 2024
27 of 28 checks passed
@mmyyrroonn mmyyrroonn deleted the fix-readme branch August 19, 2024 13:15
@xgreenx xgreenx mentioned this pull request Aug 20, 2024
xgreenx added a commit that referenced this pull request Aug 20, 2024
## Version v0.34.0

### Added
- [2051](#2051): Add support
for AWS KMS signing for the PoA consensus module. The new key can be
specified with `--consensus-aws-kms AWS_KEY_ARN`.
- [2092](#2092): Allow
iterating by keys in rocksdb, and other storages.
- [2096](#2096): GraphQL
endpoint to fetch blob byte code by its blob ID.

### Changed
- [2106](#2106): Remove
deadline clock in POA and replace with tokio time functions.

#### Breaking
- [2051](#2051): Misdocumented
`CONSENSUS_KEY` environ variable has been removed, use
`CONSENSUS_KEY_SECRET` instead. Also raises MSRV to `1.79.0`.

### Fixed

- [2106](#2106): Handle the
case when nodes with overriding start on the fresh network.
- [2105](#2105): Fixed the
rollback functionality to work with empty gas price database.

## What's Changed
* doc: refine the transaction example in the README by @mmyyrroonn in
#2072
* AWS KMS block signing support and Rust 1.79 by @Dentosal in
#2051
* feat(iterators): allow key-only iteration by @rymnc in
#2092
* feat: graphql endpoint to fetch the blob byte code by its blob ID by
@netrome in #2096
* Small improvements for tests to make them more stable by @xgreenx in
#2103
* Fixed the rollback functionality to work with empty gas price database
by @xgreenx in #2105
* Bump wasmtime version by @Dentosal in
#2089
* Handle the case when nodes with overriding start on the fresh network
by @xgreenx in #2106
* Remove deadline clock in POA and replace with tokio time functions. by
@AurelienFT in #2109

## New Contributors
* @mmyyrroonn made their first contribution in
#2072

**Full Changelog**:
v0.33.0...v0.34.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no changelog Skip the CI check of the changelog modification
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants