You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fixes#364 in a way that requires the least changes.
Only users who are manually creating `Pointer` to make a new
`PointerAddress` from parts will be affected by this API change.
We could also alternatively change *ALL* references of `Slot` and `TransactionIndex`
to support `BigNum` instead of `u32`. This would be inline with the
alonzo.cddl binary spec, but would make use of the library more
annoying, especially from javascript/wasm, as well as requiring more code changes.
I don't see why you would have a transaction index greater than even a
single byte, let alone 2^32 - 1. But since that's how the binary spec
is, it's possible we'll run into on-chain data that do this in the future.
This isn't the only place where we run into issues like this as there are
edge cases anywhere where `nint` is specified since the CBOR library we
support doesn't handle numbers between `i64::MIN` and `-u64::MAX`.
let addr2 = Address::from_bytes(addr.to_bytes()).unwrap();
717
717
assert_eq!(addr.to_bytes(), addr2.to_bytes());
@@ -827,9 +827,9 @@ mod tests {
827
827
.derive(0)
828
828
.to_public();
829
829
let spend_cred = StakeCredential::from_keyhash(&spend.to_raw_key().hash());
830
-
let addr_net_0 = PointerAddress::new(NetworkInfo::testnet().network_id(),&spend_cred,&Pointer::new(1,2,3)).to_address();
830
+
let addr_net_0 = PointerAddress::new(NetworkInfo::testnet().network_id(),&spend_cred,&Pointer::new(&to_bignum(1),&to_bignum(2),&to_bignum(3))).to_address();
let addr_net_3 = PointerAddress::new(NetworkInfo::mainnet().network_id(),&spend_cred,&Pointer::new(24157,177,42)).to_address();
832
+
let addr_net_3 = PointerAddress::new(NetworkInfo::mainnet().network_id(),&spend_cred,&Pointer::new(&to_bignum(24157),&to_bignum(177),&to_bignum(42))).to_address();
let spend_cred = StakeCredential::from_keyhash(&spend.to_raw_key().hash());
886
-
let addr_net_0 = PointerAddress::new(NetworkInfo::testnet().network_id(),&spend_cred,&Pointer::new(1,2,3)).to_address();
886
+
let addr_net_0 = PointerAddress::new(NetworkInfo::testnet().network_id(),&spend_cred,&Pointer::new(&to_bignum(1),&to_bignum(2),&to_bignum(3))).to_address();
let addr_net_3 = PointerAddress::new(NetworkInfo::mainnet().network_id(),&spend_cred,&Pointer::new(24157,177,42)).to_address();
888
+
let addr_net_3 = PointerAddress::new(NetworkInfo::mainnet().network_id(),&spend_cred,&Pointer::new(&to_bignum(24157),&to_bignum(177),&to_bignum(42))).to_address();
let spend_cred = StakeCredential::from_keyhash(&spend.to_raw_key().hash());
969
-
let addr_net_0 = PointerAddress::new(NetworkInfo::testnet().network_id(),&spend_cred,&Pointer::new(1,2,3)).to_address();
969
+
let addr_net_0 = PointerAddress::new(NetworkInfo::testnet().network_id(),&spend_cred,&Pointer::new(&to_bignum(1),&to_bignum(2),&to_bignum(3))).to_address();
let addr_net_3 = PointerAddress::new(NetworkInfo::mainnet().network_id(),&spend_cred,&Pointer::new(24157,177,42)).to_address();
971
+
let addr_net_3 = PointerAddress::new(NetworkInfo::mainnet().network_id(),&spend_cred,&Pointer::new(&to_bignum(24157),&to_bignum(177),&to_bignum(42))).to_address();
let addr = Address::from_bech32("addr_test1grqe6lg9ay8wkcu5k5e38lne63c80h3nq6xxhqfmhewf645pllllllllllll7lupllllllllllll7lupllllllllllll7lc9wayvj").unwrap();
1048
+
let ptr = PointerAddress::from_address(&addr).unwrap().stake;
0 commit comments