Skip to content

Commit

Permalink
fix snapshot
Browse files Browse the repository at this point in the history
  • Loading branch information
soze authored and soze committed May 7, 2024
1 parent a23405f commit 1cd2886
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 31 deletions.
5 changes: 2 additions & 3 deletions catalyst-gateway/bin/src/cardano/cip36_registration/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,8 @@ fn inspect_signature(cbor_value: ciborium::value::Value) -> anyhow::Result<Signa
Ok(Signature::from_bytes(&signature))
}

/// Rebuild 61284 from pallas metadata to match original signed 61284 payload
/// Rebuild 61284 from pallas metadata to match original signed 61284 payload, pallas does not preserve exact 61284 bytes
/// which is required for signature verification. It must be rebuilt and re-serialzed to perform signature verification.
fn original_61284_payload(metadata: &Metadatum) -> anyhow::Result<Vec<u8>> {
/// 61284 CIP-36
const CIP_36_61284: usize = 61284;
Expand All @@ -297,8 +298,6 @@ fn original_61284_payload(metadata: &Metadatum) -> anyhow::Result<Vec<u8>> {
.encode_fragment()
.map_err(|err| anyhow::anyhow!("cannot encode metadata into bytes {err}"))?;

validate_cip36_registration(metadata_bytes.as_slice())?;

let cbor_value = ciborium::de::from_reader::<ciborium::Value, _>(metadata_bytes.as_slice())
.map_err(|err| anyhow::anyhow!("Cannot decode cbor object from bytes, err: {err}"))?;

Expand Down
42 changes: 14 additions & 28 deletions catalyst-gateway/tests/api_tests/snapshot_tool-56364174.json
Original file line number Diff line number Diff line change
Expand Up @@ -193,20 +193,6 @@
"tx_id": 758329,
"nonce": 27894057
},
{
"delegations": [
[
"0xcd53ba0d64e3dc8beff82434d6514d9c3f485a4851201941e2dd9ff7f958a3c9",
1
]
],
"rewards_address": "0x009acd97fb8933e9a532ea59f3cc31eebb114d39fcdee1db603988b9f465bee679132338efa3df975f8aa5d7d9047d1ad465a7ee4575904596",
"stake_public_key": "0xdf1d4a395a166b178c7dc8f2ee59c440b6b4e8f898c2020e35537a819bf8b234",
"voting_power": 403470717,
"voting_purpose": 0,
"tx_id": 1205915,
"nonce": 36168765
},
{
"delegations": [
[
Expand All @@ -221,20 +207,6 @@
"tx_id": 898001,
"nonce": 30447125
},
{
"delegations": [
[
"0x030606c166a947a33bf60043e70f240eac1df7936aa056429f2521553f9d4220",
1
]
],
"rewards_address": "0x008106baa0c1e77dc1fcd5db39a9b8b44b02a2f769f8d05cb9fd922d2b40575624c917cfb508d50e3153d10b3bc916653f15575da162c55a35",
"stake_public_key": "0xbe170021430da56d675778f3feed2b851af800ae46246078bd37da4942c3143a",
"voting_power": 894284145,
"voting_purpose": 0,
"tx_id": 1151432,
"nonce": 181865062
},
{
"delegations": "0x1493fb2c46ef5e99928f08776b83166b2b18833389d06f8cb66e816e3829a627",
"rewards_address": "0x0009e751158bb9209502a47955302ae61156150f9529b3e12390700a5480d4203ddc93ca5e175ad382f2c7fd4e3ba127702251169aca278bce",
Expand Down Expand Up @@ -3734,6 +3706,20 @@
"tx_id": 949132,
"nonce": 31500349
},
{
"delegations": [
[
"0xdc06cc9b46c983af66e4c5c52463086b174780c8ab09b9aa9f4e3441c0cc9da6",
1
]
],
"rewards_address": "0x0002f1c39e73708869c5d068efce51c7a8a779620639e919adbffdf7ba7e872b69a8844a5c619738e87338d34135ea3bebb973f7181a6ff40d",
"stake_public_key": "0xed05e31db7866366a12c7414fbc3b6708740e9bdad00f6c190068db14a24ba4b",
"voting_power": 999823499,
"voting_purpose": 0,
"tx_id": 144983,
"nonce": 13450365
},
{
"delegations": [
[
Expand Down

0 comments on commit 1cd2886

Please sign in to comment.