Skip to content

Commit

Permalink
Fix linter errors
Browse files Browse the repository at this point in the history
  • Loading branch information
MatthewLM committed Aug 17, 2023
1 parent 51c0b7f commit 253c84f
Show file tree
Hide file tree
Showing 15 changed files with 35 additions and 32 deletions.
3 changes: 1 addition & 2 deletions coinlib/analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ linter:
rules:
- cancel_subscriptions
- hash_and_equals
- iterable_contains_unrelated_type
- list_remove_unrelated_type
- collection_methods_unrelated_type
- test_types_in_equals
- unrelated_type_equality_checks
- valid_regexps
Expand Down
2 changes: 1 addition & 1 deletion coinlib/bin/build_macos.dart
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ void main() async {
// Install final dylib in local directory so it can be copied
"--prefix", "$libDir/build",
// Build for arm and x86 architectures
"CFLAGS=-O2 -arch x86_64 -arch arm64"
"CFLAGS=-O2 -arch x86_64 -arch arm64",
],
workingDir: libDir,
);
Expand Down
2 changes: 1 addition & 1 deletion coinlib/example/coinlib_example.dart
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ void main() async {
P2PKHInput(prevOut: OutPoint(prevHash, 1), publicKey: key1.publicKey),
],
outputs: [
Output.fromAddress(BigInt.from(2000000), address)
Output.fromAddress(BigInt.from(2000000), address),
],
);

Expand Down
2 changes: 1 addition & 1 deletion coinlib/test/scripts/operations_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ void main() {
// PUSHDATA2 used when PUSHDATA1 suffices
"4dff00000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9fa0a1a2a3a4a5a6a7a8a9aaabacadaeafb0b1b2b3b4b5b6b7b8b9babbbcbdbebfc0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedfe0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfe",
// PUSHDATA4 when PUSHDATA2 suffices
"4e00010000000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9fa0a1a2a3a4a5a6a7a8a9aaabacadaeafb0b1b2b3b4b5b6b7b8b9babbbcbdbebfc0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedfe0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff"
"4e00010000000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9fa0a1a2a3a4a5a6a7a8a9aaabacadaeafb0b1b2b3b4b5b6b7b8b9babbbcbdbebfc0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedfe0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff",
]) {
expect(
() => ScriptOp.fromReader(BytesReader(hexToBytes(bad)), requireMinimal: true),
Expand Down
2 changes: 1 addition & 1 deletion coinlib/test/scripts/programs/p2pkh_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ void main() {
for (final bad in [
"000102030405060708090a0b0c0d0e0f101112",
"${pubkeyhashVec}14",
""
"",
]) {
expect(
() => P2PKH.fromHash(hexToBytes(bad)),
Expand Down
4 changes: 2 additions & 2 deletions coinlib/test/scripts/programs/p2sh_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ void main() {
"OP_HASH160 ${scriptHash}14 OP_EQUAL",
"OP_HASH160 $scriptHash",
"OP_HASH160 $scriptHash OP_EQUALVERIFY",
"OP_HASH256 $scriptHash OP_EQUAL"
"OP_HASH256 $scriptHash OP_EQUAL",
]) {
expect(() => P2SH.fromAsm(bad), throwsA(isA<NoProgramMatch>()));
}
Expand All @@ -62,7 +62,7 @@ void main() {
for (final bad in [
"000102030405060708090a0b0c0d0e0f101112",
"${scriptHash}14",
""
"",
]) {
expect(
() => P2SH.fromHash(hexToBytes(bad)),
Expand Down
2 changes: 1 addition & 1 deletion coinlib/test/scripts/programs/p2witness_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ void main() {
"0028${longBytes}00",
"0029${longBytes}00",
"4f020102",
""
"",
]) {
expect(
() => P2Witness.decompile(hexToBytes(bad)),
Expand Down
4 changes: 2 additions & 2 deletions coinlib/test/scripts/programs/p2wpkh_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ void main() {
"0014${pubkeyhashVec}00",
"0013000102030405060708090a0b0c0d0e0f101112",
"0015${pubkeyhashVec}14",
"00", ""
"00", "",
]) {
expect(() => P2WPKH.decompile(hexToBytes(bad)), throwsA(isA<NoProgramMatch>()));
}
Expand All @@ -62,7 +62,7 @@ void main() {
for (final bad in [
"000102030405060708090a0b0c0d0e0f101112",
"${pubkeyhashVec}14",
""
"",
]) {
expect(
() => P2WPKH.fromHash(hexToBytes(bad)),
Expand Down
4 changes: 2 additions & 2 deletions coinlib/test/scripts/programs/p2wsh_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ void main() {
"0 000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e",
"0 ${scriptHash}20",
"0 $scriptHash 0",
"01 $scriptHash"
"01 $scriptHash",
]) {
expect(
() => P2WSH.fromAsm(bad),
Expand All @@ -66,7 +66,7 @@ void main() {
for (final bad in [
"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e",
"${scriptHash}20",
""
"",
]) {
expect(
() => P2WSH.fromHash(hexToBytes(bad)),
Expand Down
2 changes: 1 addition & 1 deletion coinlib/test/tx/output_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ final vectors = [
scriptHex: "00",
outHex: "ff000000000000000100",
progType: RawProgram,
)
),
];

void main() {
Expand Down
4 changes: 2 additions & 2 deletions coinlib/test/tx/raw_input_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ void main() {
...hashBytes, // Hash
1,2,3,4, // n
1, 0, // OP_0
0xa4, 0xa3, 0xa2, 0xa1 // Sequence
0xa4, 0xa3, 0xa2, 0xa1, // Sequence
]);

expectRaw(RawInput input) {
Expand Down Expand Up @@ -62,7 +62,7 @@ void main() {
...hashBytes, // Hash
1,2,3,4, // n
4, 1, 2, 3, 4, // Not a valid script
0xff, 0xff, 0xff, 0xff // Sequence
0xff, 0xff, 0xff, 0xff, // Sequence
]);

final scriptSig = Uint8List.fromList([1,2,3,4]);
Expand Down
2 changes: 1 addition & 1 deletion coinlib/test/tx/transaction_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ void main() {
...Iterable.generate(scriptSize),
0xff, 0xff, 0xff, 0xff,
0,
0,0,0,0
0,0,0,0,
]);

}
Expand Down
2 changes: 1 addition & 1 deletion coinlib/test/vectors/bech32.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const validBech32m = [
"abcdef1l7aum6echk45nj3s0wdvt2fg8x9yrzpqzd3ryx",
"11llllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllludsr8",
"split1checkupstagehandshakeupstreamerranterredcaperredlc445v",
"?1v759aa"
"?1v759aa",
];

final invalidBech32 = [
Expand Down
2 changes: 1 addition & 1 deletion coinlib/test/vectors/keys.dart
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ final keyPairVectors = [
compressed: true,
wif: "L5oLkpV3aqBjhki6LmvChTCV6odsp4SXM6FfU2Gppt5kFLaHLuZ9",
version: 0x80,
)
),
];

final validPubKeys = [
Expand Down
30 changes: 17 additions & 13 deletions coinlib/test/vectors/tx.dart
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ final validTxVecs = [
"PCLHR5x8X2bitLes8DiSMTswpc46zt6THo",
NetworkParams.mainnet,
),
)
),
],
),
hashHex: "6b1944794c215482f9b4532ccd0f982a3be80f0a349394cc2de2c95014c563be",
Expand Down Expand Up @@ -352,7 +352,7 @@ final validTxVecs = [
"PQfazmXYxj7BKQG9jGbjKaQzYyi8AGEkH1",
NetworkParams.mainnet,
),
)
),
],
),
hashHex: "c018ee785bea0ce31228bb60afa049341bb52e018d1b59046432e9ab0016fb57",
Expand Down Expand Up @@ -414,12 +414,14 @@ final validTxVecs = [
TxVector(
obj: Transaction(
version: 3,
inputs: [P2WPKHInput(
prevOut: examplePrevOut,
publicKey: examplePubkey,
insig: exampleInsig,
sequence: 0x01020304,
)],
inputs: [
P2WPKHInput(
prevOut: examplePrevOut,
publicKey: examplePubkey,
insig: exampleInsig,
sequence: 0x01020304,
),
],
outputs: [exampleOutput],
),
hashHex: "f1cd5422c06f2f1a59bfb45307ab56f1a1720da5af766c06a2317ba43dfefafc",
Expand All @@ -438,10 +440,12 @@ final validTxVecs = [
TxVector(
obj: Transaction(
version: 3,
inputs: [WitnessInput(
prevOut: examplePrevOut,
witness: [Uint8List(0), Uint8List.fromList([0xff, 1, 2, 3])],
)],
inputs: [
WitnessInput(
prevOut: examplePrevOut,
witness: [Uint8List(0), Uint8List.fromList([0xff, 1, 2, 3])],
),
],
outputs: [exampleOutput],
),
hashHex: "ef839df6a0094f5af7a8d4bc704e0ea9ad201c956784e7d7d99350de502028b0",
Expand All @@ -454,7 +458,7 @@ final validTxVecs = [
inputTypes: [WitnessInput],
hex: "03000000000101f1fefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefe0000000000ffffffff01a0860100000000001976a914c42e7ef92fdb603af844d064faad95db9bcdfd3d88ac020004ff01020300000000",
legacyHex: "0300000001f1fefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefe0000000000ffffffff01a0860100000000001976a914c42e7ef92fdb603af844d064faad95db9bcdfd3d88ac00000000",
)
),

];

Expand Down

0 comments on commit 253c84f

Please sign in to comment.