diff --git a/Makefile b/Makefile index acd4c7e9..201f7743 100644 --- a/Makefile +++ b/Makefile @@ -21,6 +21,7 @@ clean: format: go fmt ./... + gofmt -s -w $(GO_FILES) golines: golines -w --ignore-generated --chain-split-dots --max-len=80 --reformat-tags . diff --git a/cmd/gouroboros/chainsync.go b/cmd/gouroboros/chainsync.go index b6337cf9..c5b56107 100644 --- a/cmd/gouroboros/chainsync.go +++ b/cmd/gouroboros/chainsync.go @@ -70,35 +70,35 @@ func newChainSyncFlags() *chainSyncFlags { // Intersect points (last block of previous era) for each era on testnet/mainnet var eraIntersect = map[string]map[string][]interface{}{ - "unknown": map[string][]interface{}{ - "genesis": []interface{}{}, + "unknown": { + "genesis": {}, }, - "mainnet": map[string][]interface{}{ - "genesis": []interface{}{}, + "mainnet": { + "genesis": {}, // Chain genesis, but explicit - "byron": []interface{}{}, + "byron": {}, // Last block of epoch 207 (Byron era) - "shelley": []interface{}{ + "shelley": { 4492799, "f8084c61b6a238acec985b59310b6ecec49c0ab8352249afd7268da5cff2a457", }, // Last block of epoch 235 (Shelley era) - "allegra": []interface{}{ + "allegra": { 16588737, "4e9bbbb67e3ae262133d94c3da5bffce7b1127fc436e7433b87668dba34c354a", }, // Last block of epoch 250 (Allegra era) - "mary": []interface{}{ + "mary": { 23068793, "69c44ac1dda2ec74646e4223bc804d9126f719b1c245dadc2ad65e8de1b276d7", }, // Last block of epoch 289 (Mary era) - "alonzo": []interface{}{ + "alonzo": { 39916796, "e72579ff89dc9ed325b723a33624b596c08141c7bd573ecfff56a1f7229e4d09", }, // Last block of epoch 364 (Alonzo era) - "babbage": []interface{}{ + "babbage": { 72316796, "c58a24ba8203e7629422a24d9dc68ce2ed495420bf40d9dab124373655161a20", }, @@ -108,15 +108,15 @@ var eraIntersect = map[string]map[string][]interface{}{ "e757d57eb8dc9500a61c60a39fadb63d9be6973ba96ae337fd24453d4d15c343", }, }, - "preprod": map[string][]interface{}{ - "genesis": []interface{}{}, - "alonzo": []interface{}{}, + "preprod": { + "genesis": {}, + "alonzo": {}, }, - "preview": map[string][]interface{}{ - "genesis": []interface{}{}, - "alonzo": []interface{}{}, + "preview": { + "genesis": {}, + "alonzo": {}, // Last block of epoch 3 (Alonzo era) - "babbage": []interface{}{ + "babbage": { 345594, "e47ac07272e95d6c3dc8279def7b88ded00e310f99ac3dfbae48ed9ff55e6001", }, diff --git a/ledger/alonzo/genesis_test.go b/ledger/alonzo/genesis_test.go index f5cfe7f3..f804f18e 100644 --- a/ledger/alonzo/genesis_test.go +++ b/ledger/alonzo/genesis_test.go @@ -227,8 +227,8 @@ var expectedGenesisObj = alonzo.AlonzoGenesis{ CollateralPercentage: 150, MaxCollateralInputs: 3, ExecutionPrices: map[string]map[string]int{ - "prMem": map[string]int{"denominator": 10000, "numerator": 577}, - "prSteps": map[string]int{"denominator": 10000000, "numerator": 721}, + "prMem": {"denominator": 10000, "numerator": 577}, + "prSteps": {"denominator": 10000000, "numerator": 721}, }, MaxTxExUnits: map[string]int{ "exUnitsMem": 10000000, @@ -239,7 +239,7 @@ var expectedGenesisObj = alonzo.AlonzoGenesis{ "exUnitsSteps": 40000000000, }, CostModels: map[string]map[string]int{ - "PlutusV1": map[string]int{ + "PlutusV1": { "addInteger-cpu-arguments-intercept": 197209, "addInteger-cpu-arguments-slope": 0, "addInteger-memory-arguments-intercept": 1, @@ -411,11 +411,17 @@ var expectedGenesisObj = alonzo.AlonzoGenesis{ } func TestGenesisFromJson(t *testing.T) { - tmpGenesis, err := alonzo.NewAlonzoGenesisFromReader(strings.NewReader(alonzoGenesisConfig)) + tmpGenesis, err := alonzo.NewAlonzoGenesisFromReader( + strings.NewReader(alonzoGenesisConfig), + ) if err != nil { t.Fatalf("unexpected error: %s", err) } if !reflect.DeepEqual(tmpGenesis, expectedGenesisObj) { - t.Fatalf("did not get expected object:\n got: %#v\n wanted: %#v", tmpGenesis, expectedGenesisObj) + t.Fatalf( + "did not get expected object:\n got: %#v\n wanted: %#v", + tmpGenesis, + expectedGenesisObj, + ) } } diff --git a/ledger/byron/genesis_test.go b/ledger/byron/genesis_test.go index 5af592ee..182c0aff 100644 --- a/ledger/byron/genesis_test.go +++ b/ledger/byron/genesis_test.go @@ -145,43 +145,43 @@ var expectedGenesisObj = byron.ByronGenesis{ "af2800c124e599d6dec188a75f8bfde397ebb778163a18240371f2d1": 1, }, HeavyDelegation: map[string]byron.ByronGenesisHeavyDelegation{ - "1deb82908402c7ee3efeb16f369d97fba316ee621d09b32b8969e54b": byron.ByronGenesisHeavyDelegation{ + "1deb82908402c7ee3efeb16f369d97fba316ee621d09b32b8969e54b": { Cert: "c8b39f094dc00608acb2d20ff274cb3e0c022ccb0ce558ea7c1a2d3a32cd54b42cc30d32406bcfbb7f2f86d05d2032848be15b178e3ad776f8b1bc56a671400d", DelegatePk: "6MA6A8Cy3b6kGVyvOfQeZp99JR7PIh+7LydcCl1+BdGQ3MJG9WyOM6wANwZuL2ZN2qmF6lKECCZDMI3eT1v+3w==", IssuerPk: "UHMxYf2vtsjLb64OJb35VVEFs2eO+wjxd1uekN5PXHe8yM7/+NkBHLJ4so/dyG2bqwmWVtd6eFbHYZEIy/ZXUg==", Omega: 0, }, - "43011479a595b300e0726910d0b602ffcdd20466a3b8ceeacd3fbc26": byron.ByronGenesisHeavyDelegation{ + "43011479a595b300e0726910d0b602ffcdd20466a3b8ceeacd3fbc26": { Cert: "cf6ddc111545f61c2442b68bd7864ea952c428d145438948ef48a4af7e3f49b175564007685be5ae3c9ece0ab27de09721db0cb63aa67dc081a9f82d7e84210d", DelegatePk: "kYDYGOac2ZfjRmPEGKZIwHby4ZzUGU5IbhWdhYC8bNqBNERAxq0OUwb9A1vvkoHaXY+9OPWfWI9wgQFu5hET0g==", IssuerPk: "0pZchpkBIxeYxdAtOfyip5qkfD6FSSG1hVyC/RRwiRUX4fp3FlXsjK0T7PblcZrcU5L8BX4XA9X1gzEeg3Ri8Q==", Omega: 0, }, - "5071d8802ddd05c59f4db907bd1749e82e6242caf6512b20a8368fcf": byron.ByronGenesisHeavyDelegation{ + "5071d8802ddd05c59f4db907bd1749e82e6242caf6512b20a8368fcf": { Cert: "496b29b5c57e8ac7cffc6e8b5e40b3d260e407ad4d09792decb0a22d54da7f8828265688a18aa1a5c76d9e7477a5f4a650501409fdcd3855b300fd2e2bc3c605", DelegatePk: "icKfjErye3rMvliXR4IBNOu6ocrzzpSScKPQx9z9VBsd7zJtLvDbeANByeJh8EiQze7x+cmfbZC47cp9PPwJiA==", IssuerPk: "mTqPBW0tPlCwrGATnxDfj4Ej1ffEgXtA2sK13YqpSoLoU2gy5jEt38B4fXtTEMgVZVraT9vPaxIpfURY7Mwt+w==", Omega: 0, }, - "5411c7bf87c252609831a337a713e4859668cba7bba70a9c3ef7c398": byron.ByronGenesisHeavyDelegation{ + "5411c7bf87c252609831a337a713e4859668cba7bba70a9c3ef7c398": { Cert: "c946fd596bdb31949aa435390de19a549c9698cad1813e34ff2431bc06190188188f4e84001380713e3f916c7526096e7c4855904bff40385007b81e1e657d0e", DelegatePk: "i1Mgdin5ow5LIBUETzN8AXNavmckPBlHDJ2ujHtzJ5gJiHufQg1vcO4enVDBYFKHjlRLZctdRL1pF1ayhM2Cmw==", IssuerPk: "mm+jQ8jGw23ho1Vv60Eb/fhwjVr4jehibQ/Gv6Tuu22Zq4PZDWZTGtkSLT+ctLydBbJkSGclMqaNp5b5MoQx/Q==", Omega: 0, }, - "65904a89e6d0e5f881513d1736945e051b76f095eca138ee869d543d": byron.ByronGenesisHeavyDelegation{ + "65904a89e6d0e5f881513d1736945e051b76f095eca138ee869d543d": { Cert: "552741f728196e62f218047b944b24ce4d374300d04b9b281426f55aa000d53ded66989ad5ea0908e6ff6492001ff18ece6c7040a934060759e9ae09863bf203", DelegatePk: "X93u2t4nFNbbL54RBHQ9LY2Bjs3cMG4XYQjbFMqt1EG0V9WEDGD4hAuZyPeMKQriKdT4Qx5ni6elRcNWB7lN2w==", IssuerPk: "C9sfXvPZlAN1k/ImYlXxNKVkZYuy34FLO5zvuW2jT6nIiFkchbdw/TZybV89mRxmiCiv/Hu+CHL9aZE25mTZ2A==", Omega: 0, }, - "6c9e14978b9d6629b8703f4f25e9df6ed4814b930b8403b0d45350ea": byron.ByronGenesisHeavyDelegation{ + "6c9e14978b9d6629b8703f4f25e9df6ed4814b930b8403b0d45350ea": { Cert: "8ab43e904b06e799c1817c5ced4f3a7bbe15cdbf422dea9d2d5dc2c6105ce2f4d4c71e5d4779f6c44b770a133636109949e1f7786acb5a732bcdea0470fea406", DelegatePk: "8U9xLcYA15MFLUhC1QzvpOZYhOps+DcHB564zjAu/IXa6SLV6zg40rkXhPBIJNJnZ7+2W9NqNudP7EbQnZiFjQ==", IssuerPk: "JlZuhvxrmxd8hIDidbKxErVz9tBz+d7qU7jZnE7ZdrM1srOELw44AAHwkLySPKqWke2RFeKG2pQh4nRcesyH8Q==", Omega: 0, }, - "af2800c124e599d6dec188a75f8bfde397ebb778163a18240371f2d1": byron.ByronGenesisHeavyDelegation{ + "af2800c124e599d6dec188a75f8bfde397ebb778163a18240371f2d1": { Cert: "e03e62f083df5576360e60a32e22bbb07b3c8df4fcab8079f1d6f61af3954d242ba8a06516c395939f24096f3df14e103a7d9c2b80a68a9363cf1f27c7a4e307", DelegatePk: "YSYalbdhPua/IGfa13twNJcpsMUNV7wc8w3g20oec6iF0AVK98I/xsN5GdukHGAqV+LQ+TKaeVS4ZzONb7LJRQ==", IssuerPk: "G8l6L+AsKXiAzo7P2Zf+TB7AnuEP7u6faGdgFmsFKB1ig0aP/ZO+ywyVbM3dZC35sSRMkVkRGF+kk1X28iv6uQ==", @@ -190,43 +190,43 @@ var expectedGenesisObj = byron.ByronGenesis{ }, NonAvvmBalances: map[string]interface{}{}, VssCerts: map[string]byron.ByronGenesisVssCert{ - "0efd6f3b2849d5baf25b3e2bf2d46f88427b4e455fc3dc43f57819c5": byron.ByronGenesisVssCert{ + "0efd6f3b2849d5baf25b3e2bf2d46f88427b4e455fc3dc43f57819c5": { ExpiryEpoch: 5, Signature: "d381d32a18cd12a1c6ff87da0229c9a5b998fd093ac29f5d932bfc918e7dbc6e1dc292a36c46a3e129c5b1ef661124361426b443480534ff51dacc82bf4b630f", SigningKey: "kYDYGOac2ZfjRmPEGKZIwHby4ZzUGU5IbhWdhYC8bNqBNERAxq0OUwb9A1vvkoHaXY+9OPWfWI9wgQFu5hET0g==", VssKey: "WCECgow+hJK+BxjNx0gIYrap+onUsRocObQEVzvJsdj68vw=", }, - "1040655f58d5bf2be1c06f983abf66c7f01d28c239f27648a0c73e5d": byron.ByronGenesisVssCert{ + "1040655f58d5bf2be1c06f983abf66c7f01d28c239f27648a0c73e5d": { ExpiryEpoch: 5, Signature: "b02e89abb183da7c871bca87a563d38356b44f403348b6a5f24ee4459335290d980db69a6482455aae231a9880defe2fd4212272c4b2ea3da8744a8ba750440a", SigningKey: "icKfjErye3rMvliXR4IBNOu6ocrzzpSScKPQx9z9VBsd7zJtLvDbeANByeJh8EiQze7x+cmfbZC47cp9PPwJiA==", VssKey: "WCECQoZjWJSu/6R74CC0ueh7cXmR0sasmTuCqf8X0BtAQ4o=", }, - "1fa56ba63cff50d124b6af42f33b245a30fcd1b0170d7704b0b201c7": byron.ByronGenesisVssCert{ + "1fa56ba63cff50d124b6af42f33b245a30fcd1b0170d7704b0b201c7": { ExpiryEpoch: 5, Signature: "7bb244c4fa1499021b0f2d36515a1f288a33cf00f1b88b57626998b439dcfb03ad88a7bc93101e4d83cdc75329799fbb2ccb28a7212a3e49737b06287d09b00c", SigningKey: "YSYalbdhPua/IGfa13twNJcpsMUNV7wc8w3g20oec6iF0AVK98I/xsN5GdukHGAqV+LQ+TKaeVS4ZzONb7LJRQ==", VssKey: "WCECNXeQRqiTZSPDDyeRJ3gl/QzYMLLtNH0yN+XOl17pu8Y=", }, - "5ffca3a329599727e39a7472c5270e54cf59a27b74306cc9f7fd0f5e": byron.ByronGenesisVssCert{ + "5ffca3a329599727e39a7472c5270e54cf59a27b74306cc9f7fd0f5e": { ExpiryEpoch: 5, Signature: "6cc8d84dd55b41efcf46c4b3086da1fb60c938182b4b66657650839d9fac1e2194a8253dc6d5c107ac0e9e714d1364fff9d2114eae07363d9937ee1d92b69c06", SigningKey: "i1Mgdin5ow5LIBUETzN8AXNavmckPBlHDJ2ujHtzJ5gJiHufQg1vcO4enVDBYFKHjlRLZctdRL1pF1ayhM2Cmw==", VssKey: "WCEDca27BxibVjQoA1QJaWx4gAE2MUB0lHfb6jJ3iorXD7s=", }, - "6bef444609d6e336cb1fe1daba278918dbc5768e6754c2945dd8d25c": byron.ByronGenesisVssCert{ + "6bef444609d6e336cb1fe1daba278918dbc5768e6754c2945dd8d25c": { ExpiryEpoch: 5, Signature: "2d96e4d4a4c506cc5762128b814ffb20afb97d30eb976334cd241a3935bd155ea1d68772b0903bde4584470359206769d83fa2ce55f56a1027ec3c52cb5e8703", SigningKey: "6MA6A8Cy3b6kGVyvOfQeZp99JR7PIh+7LydcCl1+BdGQ3MJG9WyOM6wANwZuL2ZN2qmF6lKECCZDMI3eT1v+3w==", VssKey: "WCED6k6ArqOnhQtfNRg0FSCxWmAtocZcyV33AdjMotjGwxI=", }, - "ce1e50f578d3043dc78d8777f5723cc7b6ca512d8cdbe8a09aafc9c3": byron.ByronGenesisVssCert{ + "ce1e50f578d3043dc78d8777f5723cc7b6ca512d8cdbe8a09aafc9c3": { ExpiryEpoch: 5, Signature: "2b830f1a79d2baca791a90c3784d74ec9f00267efac5ccd3cd7082b854234f411c237b59f34736933ba626fadc87fd6b2114c44486de692892d7401343990e01", SigningKey: "8U9xLcYA15MFLUhC1QzvpOZYhOps+DcHB564zjAu/IXa6SLV6zg40rkXhPBIJNJnZ7+2W9NqNudP7EbQnZiFjQ==", VssKey: "WCECs1+lg8Lsm15FxfY8bhGyRuwe8yOaSH0wwSajLRYeW/s=", }, - "eb649333a196ecb024a4a5919d3ce86084014136fd3e884e52ecd057": byron.ByronGenesisVssCert{ + "eb649333a196ecb024a4a5919d3ce86084014136fd3e884e52ecd057": { ExpiryEpoch: 5, Signature: "0b115a39935ce6008a4bbad0377f35463fd3510e282186ba43492768a02eb000bd4d3bc50799a24c53879ff2f2587179e797ee1c312acaf107cba67f91cb280b", SigningKey: "X93u2t4nFNbbL54RBHQ9LY2Bjs3cMG4XYQjbFMqt1EG0V9WEDGD4hAuZyPeMKQriKdT4Qx5ni6elRcNWB7lN2w==", @@ -236,11 +236,17 @@ var expectedGenesisObj = byron.ByronGenesis{ } func TestGenesisFromJson(t *testing.T) { - tmpGenesis, err := byron.NewByronGenesisFromReader(strings.NewReader(byronGenesisConfig)) + tmpGenesis, err := byron.NewByronGenesisFromReader( + strings.NewReader(byronGenesisConfig), + ) if err != nil { t.Fatalf("unexpected error: %s", err) } if !reflect.DeepEqual(tmpGenesis, expectedGenesisObj) { - t.Fatalf("did not get expected object:\n got: %#v\n wanted: %#v", tmpGenesis, expectedGenesisObj) + t.Fatalf( + "did not get expected object:\n got: %#v\n wanted: %#v", + tmpGenesis, + expectedGenesisObj, + ) } } diff --git a/ledger/common/common.go b/ledger/common/common.go index 56c69f17..98bc9fff 100644 --- a/ledger/common/common.go +++ b/ledger/common/common.go @@ -134,7 +134,9 @@ type MultiAsset[T MultiAssetTypeOutput | MultiAssetTypeMint] struct { } // NewMultiAsset creates a MultiAsset with the specified data -func NewMultiAsset[T MultiAssetTypeOutput | MultiAssetTypeMint](data map[Blake2b224]map[cbor.ByteString]T) MultiAsset[T] { +func NewMultiAsset[T MultiAssetTypeOutput | MultiAssetTypeMint]( + data map[Blake2b224]map[cbor.ByteString]T, +) MultiAsset[T] { return MultiAsset[T]{data: data} } diff --git a/ledger/conway/genesis_test.go b/ledger/conway/genesis_test.go index a28f3770..df50d92c 100644 --- a/ledger/conway/genesis_test.go +++ b/ledger/conway/genesis_test.go @@ -383,11 +383,17 @@ var expectedGenesisObj = conway.ConwayGenesis{ } func TestGenesisFromJson(t *testing.T) { - tmpGenesis, err := conway.NewConwayGenesisFromReader(strings.NewReader(conwayGenesisConfig)) + tmpGenesis, err := conway.NewConwayGenesisFromReader( + strings.NewReader(conwayGenesisConfig), + ) if err != nil { t.Fatalf("unexpected error: %s", err) } if !reflect.DeepEqual(tmpGenesis, expectedGenesisObj) { - t.Fatalf("did not get expected object:\n got: %#v\n wanted: %#v", tmpGenesis, expectedGenesisObj) + t.Fatalf( + "did not get expected object:\n got: %#v\n wanted: %#v", + tmpGenesis, + expectedGenesisObj, + ) } } diff --git a/ledger/shelley/genesis_test.go b/ledger/shelley/genesis_test.go index 0f12f777..382bf316 100644 --- a/ledger/shelley/genesis_test.go +++ b/ledger/shelley/genesis_test.go @@ -95,7 +95,16 @@ const shelleyGenesisConfig = ` ` var expectedGenesisObj = shelley.ShelleyGenesis{ - SystemStart: time.Date(2017, time.September, 23, 21, 44, 51, 0, time.UTC), + SystemStart: time.Date( + 2017, + time.September, + 23, + 21, + 44, + 51, + 0, + time.UTC, + ), NetworkMagic: 764824073, NetworkId: "Mainnet", ActiveSlotsCoeff: 0.05, @@ -134,31 +143,31 @@ var expectedGenesisObj = shelley.ShelleyGenesis{ MinPoolCost: 340000000, }, GenDelegs: map[string]map[string]any{ - "162f94554ac8c225383a2248c245659eda870eaa82d0ef25fc7dcd82": map[string]any{ + "162f94554ac8c225383a2248c245659eda870eaa82d0ef25fc7dcd82": { "delegate": "4485708022839a7b9b8b639a939c85ec0ed6999b5b6dc651b03c43f6", "vrf": "aba81e764b71006c515986bf7b37a72fbb5554f78e6775f08e384dbd572a4b32", }, - "2075a095b3c844a29c24317a94a643ab8e22d54a3a3a72a420260af6": map[string]any{ + "2075a095b3c844a29c24317a94a643ab8e22d54a3a3a72a420260af6": { "delegate": "6535db26347283990a252313a7903a45e3526ec25ddba381c071b25b", "vrf": "fcaca997b8105bd860876348fc2c6e68b13607f9bbd23515cd2193b555d267af", }, - "268cfc0b89e910ead22e0ade91493d8212f53f3e2164b2e4bef0819b": map[string]any{ + "268cfc0b89e910ead22e0ade91493d8212f53f3e2164b2e4bef0819b": { "delegate": "1d4f2e1fda43070d71bb22a5522f86943c7c18aeb4fa47a362c27e23", "vrf": "63ef48bc5355f3e7973100c371d6a095251c80ceb40559f4750aa7014a6fb6db", }, - "60baee25cbc90047e83fd01e1e57dc0b06d3d0cb150d0ab40bbfead1": map[string]any{ + "60baee25cbc90047e83fd01e1e57dc0b06d3d0cb150d0ab40bbfead1": { "delegate": "7f72a1826ae3b279782ab2bc582d0d2958de65bd86b2c4f82d8ba956", "vrf": "c0546d9aa5740afd569d3c2d9c412595cd60822bb6d9a4e8ce6c43d12bd0f674", }, - "ad5463153dc3d24b9ff133e46136028bdc1edbb897f5a7cf1b37950c": map[string]any{ + "ad5463153dc3d24b9ff133e46136028bdc1edbb897f5a7cf1b37950c": { "delegate": "d9e5c76ad5ee778960804094a389f0b546b5c2b140a62f8ec43ea54d", "vrf": "64fa87e8b29a5b7bfbd6795677e3e878c505bc4a3649485d366b50abadec92d7", }, - "b9547b8a57656539a8d9bc42c008e38d9c8bd9c8adbb1e73ad529497": map[string]any{ + "b9547b8a57656539a8d9bc42c008e38d9c8bd9c8adbb1e73ad529497": { "delegate": "855d6fc1e54274e331e34478eeac8d060b0b90c1f9e8a2b01167c048", "vrf": "66d5167a1f426bd1adcc8bbf4b88c280d38c148d135cb41e3f5a39f948ad7fcc", }, - "f7b341c14cd58fca4195a9b278cce1ef402dc0e06deb77e543cd1757": map[string]any{ + "f7b341c14cd58fca4195a9b278cce1ef402dc0e06deb77e543cd1757": { "delegate": "69ae12f9e45c0c9122356c8e624b1fbbed6c22a2e3b4358cf0cb5011", "vrf": "6394a632af51a32768a6f12dac3485d9c0712d0b54e3f389f355385762a478f2", }, @@ -167,11 +176,17 @@ var expectedGenesisObj = shelley.ShelleyGenesis{ } func TestGenesisFromJson(t *testing.T) { - tmpGenesis, err := shelley.NewShelleyGenesisFromReader(strings.NewReader(shelleyGenesisConfig)) + tmpGenesis, err := shelley.NewShelleyGenesisFromReader( + strings.NewReader(shelleyGenesisConfig), + ) if err != nil { t.Fatalf("unexpected error: %s", err) } if !reflect.DeepEqual(tmpGenesis, expectedGenesisObj) { - t.Fatalf("did not get expected object:\n got: %#v\n wanted: %#v", tmpGenesis, expectedGenesisObj) + t.Fatalf( + "did not get expected object:\n got: %#v\n wanted: %#v", + tmpGenesis, + expectedGenesisObj, + ) } } diff --git a/ledger/verify_block_body.go b/ledger/verify_block_body.go index a16d7c9a..839d45ad 100644 --- a/ledger/verify_block_body.go +++ b/ledger/verify_block_body.go @@ -366,7 +366,9 @@ func CalculateBlockBodyHash(txsRaw [][]string) ([]byte, error) { txSeqMetadataSum32Bytes := blake2b.Sum256(txSeqMetadataBytes) txSeqMetadataSumBytes := txSeqMetadataSum32Bytes[:] - txSeqNonValidBytes, txSeqNonValidBytesError := EncodeCborTxSeq(txSeqNonValid) + txSeqNonValidBytes, txSeqNonValidBytesError := EncodeCborTxSeq( + txSeqNonValid, + ) if txSeqNonValidBytesError != nil { return nil, fmt.Errorf( "CalculateBlockBodyHash: encode txSeqNonValid error, %v", @@ -490,8 +492,10 @@ func ExtractTokens(output TransactionOutput) ([]UTXOOutputToken, error) { for _, assetName := range tmpAssets.Assets(policyId) { amount := tmpAssets.Asset(policyId, assetName) outputTokens = append(outputTokens, UTXOOutputToken{ - TokenAssetName: policyId.String() + hex.EncodeToString(assetName), - TokenValue: strconv.FormatUint(amount, 10), + TokenAssetName: policyId.String() + hex.EncodeToString( + assetName, + ), + TokenValue: strconv.FormatUint(amount, 10), }) } } diff --git a/protocol/chainsync/messages_test.go b/protocol/chainsync/messages_test.go index 1f5ef3dc..f5fb8f41 100644 --- a/protocol/chainsync/messages_test.go +++ b/protocol/chainsync/messages_test.go @@ -334,7 +334,7 @@ func TestMsgFindIntersect(t *testing.T) { CborHex: "82048180", Message: NewMsgFindIntersect( []common.Point{ - common.Point{}, + {}, }, ), MessageType: MessageTypeFindIntersect, @@ -344,7 +344,7 @@ func TestMsgFindIntersect(t *testing.T) { CborHex: "820481821a001863bf58207e16781b40ebf8b6da18f7b5e8ade855d6738095ef2f1c58c77e88b6e45997a4", Message: NewMsgFindIntersect( []common.Point{ - common.Point{ + { Slot: 1598399, Hash: hexDecode( "7E16781B40EBF8B6DA18F7B5E8ADE855D6738095EF2F1C58C77E88B6E45997A4", diff --git a/protocol/localstatequery/client_test.go b/protocol/localstatequery/client_test.go index dcacde35..39e0249d 100644 --- a/protocol/localstatequery/client_test.go +++ b/protocol/localstatequery/client_test.go @@ -234,7 +234,7 @@ func TestGetUTxOByAddress(t *testing.T) { } expectedResult := localstatequery.UTxOByAddressResult{ Results: map[localstatequery.UtxoId]ledger.BabbageTransactionOutput{ - expectedUtxoId: ledger.BabbageTransactionOutput{ + expectedUtxoId: { OutputAddress: testAddress, OutputAmount: ledger.MaryTransactionOutputValue{ Amount: 234567, diff --git a/protocol/versions.go b/protocol/versions.go index ab457554..e5317549 100644 --- a/protocol/versions.go +++ b/protocol/versions.go @@ -46,7 +46,7 @@ var protocolVersions = map[uint16]ProtocolVersion{ // // We don't bother supporting NtC protocol versions before 9 (when Alonzo was enabled) - (9 + ProtocolVersionNtCOffset): ProtocolVersion{ + (9 + ProtocolVersionNtCOffset): { NewVersionDataFromCborFunc: NewVersionDataNtC9to14FromCbor, EnableLocalQueryProtocol: true, EnableShelleyEra: true, @@ -55,7 +55,7 @@ var protocolVersions = map[uint16]ProtocolVersion{ EnableAlonzoEra: true, }, // added GetChainBlockNo and GetChainPoint queries - (10 + ProtocolVersionNtCOffset): ProtocolVersion{ + (10 + ProtocolVersionNtCOffset): { NewVersionDataFromCborFunc: NewVersionDataNtC9to14FromCbor, EnableLocalQueryProtocol: true, EnableShelleyEra: true, @@ -64,7 +64,7 @@ var protocolVersions = map[uint16]ProtocolVersion{ EnableAlonzoEra: true, }, // added GetRewardInfoPools Block query - (11 + ProtocolVersionNtCOffset): ProtocolVersion{ + (11 + ProtocolVersionNtCOffset): { NewVersionDataFromCborFunc: NewVersionDataNtC9to14FromCbor, EnableLocalQueryProtocol: true, EnableShelleyEra: true, @@ -72,7 +72,7 @@ var protocolVersions = map[uint16]ProtocolVersion{ EnableMaryEra: true, EnableAlonzoEra: true, }, - (12 + ProtocolVersionNtCOffset): ProtocolVersion{ + (12 + ProtocolVersionNtCOffset): { NewVersionDataFromCborFunc: NewVersionDataNtC9to14FromCbor, EnableLocalQueryProtocol: true, EnableShelleyEra: true, @@ -81,7 +81,7 @@ var protocolVersions = map[uint16]ProtocolVersion{ EnableAlonzoEra: true, EnableLocalTxMonitorProtocol: true, }, - (13 + ProtocolVersionNtCOffset): ProtocolVersion{ + (13 + ProtocolVersionNtCOffset): { NewVersionDataFromCborFunc: NewVersionDataNtC9to14FromCbor, EnableLocalQueryProtocol: true, EnableShelleyEra: true, @@ -92,7 +92,7 @@ var protocolVersions = map[uint16]ProtocolVersion{ EnableLocalTxMonitorProtocol: true, }, // added GetPoolDistr, GetPoolState, @GetSnapshots - (14 + ProtocolVersionNtCOffset): ProtocolVersion{ + (14 + ProtocolVersionNtCOffset): { NewVersionDataFromCborFunc: NewVersionDataNtC9to14FromCbor, EnableLocalQueryProtocol: true, EnableShelleyEra: true, @@ -103,7 +103,7 @@ var protocolVersions = map[uint16]ProtocolVersion{ EnableLocalTxMonitorProtocol: true, }, // added query param to handshake - (15 + ProtocolVersionNtCOffset): ProtocolVersion{ + (15 + ProtocolVersionNtCOffset): { NewVersionDataFromCborFunc: NewVersionDataNtC15andUpFromCbor, EnableLocalQueryProtocol: true, EnableShelleyEra: true, @@ -113,7 +113,7 @@ var protocolVersions = map[uint16]ProtocolVersion{ EnableBabbageEra: true, EnableLocalTxMonitorProtocol: true, }, - (16 + ProtocolVersionNtCOffset): ProtocolVersion{ + (16 + ProtocolVersionNtCOffset): { NewVersionDataFromCborFunc: NewVersionDataNtC15andUpFromCbor, EnableLocalQueryProtocol: true, EnableShelleyEra: true, @@ -129,7 +129,7 @@ var protocolVersions = map[uint16]ProtocolVersion{ // // We don't bother supporting NtN protocol versions before 7 (when Alonzo was enabled) - 7: ProtocolVersion{ + 7: { NewVersionDataFromCborFunc: NewVersionDataNtN7to10FromCbor, EnableShelleyEra: true, EnableKeepAliveProtocol: true, @@ -137,7 +137,7 @@ var protocolVersions = map[uint16]ProtocolVersion{ EnableMaryEra: true, EnableAlonzoEra: true, }, - 8: ProtocolVersion{ + 8: { NewVersionDataFromCborFunc: NewVersionDataNtN7to10FromCbor, EnableShelleyEra: true, EnableKeepAliveProtocol: true, @@ -145,7 +145,7 @@ var protocolVersions = map[uint16]ProtocolVersion{ EnableMaryEra: true, EnableAlonzoEra: true, }, - 9: ProtocolVersion{ + 9: { NewVersionDataFromCborFunc: NewVersionDataNtN7to10FromCbor, EnableShelleyEra: true, EnableKeepAliveProtocol: true, @@ -154,7 +154,7 @@ var protocolVersions = map[uint16]ProtocolVersion{ EnableAlonzoEra: true, EnableBabbageEra: true, }, - 10: ProtocolVersion{ + 10: { NewVersionDataFromCborFunc: NewVersionDataNtN7to10FromCbor, EnableShelleyEra: true, EnableKeepAliveProtocol: true, @@ -164,7 +164,7 @@ var protocolVersions = map[uint16]ProtocolVersion{ EnableBabbageEra: true, EnableFullDuplex: true, }, - 11: ProtocolVersion{ + 11: { NewVersionDataFromCborFunc: NewVersionDataNtN11to12FromCbor, EnableShelleyEra: true, EnableKeepAliveProtocol: true, @@ -176,7 +176,7 @@ var protocolVersions = map[uint16]ProtocolVersion{ EnablePeerSharingProtocol: true, PeerSharingUseV11: true, }, - 12: ProtocolVersion{ + 12: { NewVersionDataFromCborFunc: NewVersionDataNtN11to12FromCbor, EnableShelleyEra: true, EnableKeepAliveProtocol: true, @@ -189,7 +189,7 @@ var protocolVersions = map[uint16]ProtocolVersion{ EnablePeerSharingProtocol: true, PeerSharingUseV11: true, }, - 13: ProtocolVersion{ + 13: { NewVersionDataFromCborFunc: NewVersionDataNtN13andUpFromCbor, EnableShelleyEra: true, EnableKeepAliveProtocol: true,