Error on "Counter" contract example

Hi guys
I was just doing an intro to development on SWAY for a friend and we ran into the following error in the counter project

cargo test                                                                                                          (101) (*master+1) 14:58:33 
   Compiling counter-contract v0.1.0 (/Users/alexey/Desktop/fuel)
    Finished test [unoptimized + debuginfo] target(s) in 4.74s
     Running tests/harness.rs (target/debug/deps/integration_tests-ead747581303366b)

running 1 test
test can_get_contract_id ... FAILED

failures:

---- can_get_contract_id stdout ----
1e51522325399aec8bb52b7abf94d182f2dd12ab0c4a4d49ec3b476fa4d36a9f
thread 'can_get_contract_id' panicked at 'called `Result::unwrap()` on an `Err` value: RevertTransactionError { reason: "Revert", revert_id: 0, receipts: [Call { id: 0000000000000000000000000000000000000000000000000000000000000000, to: 1e51522325399aec8bb52b7abf94d182f2dd12ab0c4a4d49ec3b476fa4d36a9f, amount: 0, asset_id: 0000000000000000000000000000000000000000000000000000000000000000, gas: 1000000, param1: 1012642802, param2: 1, pc: 11624, is: 11624 }, Revert { id: 1e51522325399aec8bb52b7abf94d182f2dd12ab0c4a4d49ec3b476fa4d36a9f, ra: 0, pc: 11900, is: 11624 }, ScriptResult { result: Revert, gas_used: 341 }] }', tests/harness.rs:42:61
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace


failures:
    can_get_contract_id

test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.25s

error: test failed, to rerun pass `--test integration_tests`

Code

Test

Repo

Can you help please?

1 Like

Hey Alex, looks to me like what we solved here: Mismatched types - StorageKey<u64> - #14 by maurice

Let me know in case that doesn’t work for you :slight_smile:

2 Likes

Thanks ser
Will try :saluting_face:

1 Like

Yes, That works, Thanks a lot <3
I have a question
Why is the counter value None if we have declared the initial value here?

storage {   
    counter: u64 = 0,
}
 
1 Like