Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release/v0.0.1 alpha.135 #123

Merged
merged 3 commits into from
Oct 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,18 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

### [0.0.1-alpha.135](https://github.com/DIG-Network/dig-chia-sdk/compare/v0.0.1-alpha.134...v0.0.1-alpha.135) (2024-10-05)


### Features

* bottleneck fullnode requests to 100 requests per min ([85c7529](https://github.com/DIG-Network/dig-chia-sdk/commit/85c7529acf36b1df6c1dff127d9a8c6770abb3f0))


### Bug Fixes

* ping peer message ([a18ccae](https://github.com/DIG-Network/dig-chia-sdk/commit/a18ccae01f1685e7ebc73381599e77b334e9e7d5))

### [0.0.1-alpha.134](https://github.com/DIG-Network/dig-chia-sdk/compare/v0.0.1-alpha.133...v0.0.1-alpha.134) (2024-10-05)


Expand Down
19 changes: 19 additions & 0 deletions dig.crt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
-----BEGIN CERTIFICATE-----
MIIDLDCCAhSgAwIBAgIUP/RkfZQ+VLvSfQ2qOf7peUnDd/gwDQYJKoZIhvcNAQEL
BQAwRDENMAsGA1UECgwEQ2hpYTEQMA4GA1UEAwwHQ2hpYSBDQTEhMB8GA1UECwwY
T3JnYW5pYyBGYXJtaW5nIERpdmlzaW9uMCAXDTI0MTAwNDE4MzQzNVoYDzIxMDAw
ODAyMDAwMDAwWjBBMQ0wCwYDVQQDDARDaGlhMQ0wCwYDVQQKDARDaGlhMSEwHwYD
VQQLDBhPcmdhbmljIEZhcm1pbmcgRGl2aXNpb24wggEiMA0GCSqGSIb3DQEBAQUA
A4IBDwAwggEKAoIBAQCqvzy6I/4sgmPLLA78WVnmbO63PYS/E0EMNFP/OBi3/4ci
XnsYzmXnLUgmvi/C5OJiJz8OKKC4sh3GJ1hZxqDDjwr8l2w4mL94IqzA9cvRLSuj
KlJSlLBk3W9DBat/MGIgFp2bGyIn7EeRC/kg6AChuvWhuQ5LgIB9zjIkIaeIH5Pb
meQEsNHGtnECO/RwXJ/Md//AlEmX70pwdfXaD83aXjacX/iSsIzzfZ3T6Y0DyncT
oC+b/HpFsWCq5l72AKgRsn0zuh9gKYw1EjremRRhex/vEGoidncuVyS2Q7gaU+Zs
6mXKUTYN10C/ffLyaY0j5HtrTAnRu+Sr2SxPqjErAgMBAAGjFzAVMBMGA1UdEQQM
MAqCCGNoaWEubmV0MA0GCSqGSIb3DQEBCwUAA4IBAQAQ+8jR1tx1lTOpT6dkH8cD
gLU/I/r2kMehkAVYPCZA2cASlNN1wW/TTfI+lmXDl93XqhLPVuwDXPUcDK/1gIEq
NtJxBHBgCY4obdiYYWugV9XjwDoUCkqFNLiHBenUsFab6CHTQBh2EwI85bnstyl0
vyEpeC6bLcCWkhGMX6pVUEGQ1vM6FsxkS/ViGPvLDXTHNRfllHyqvFx/tOwP19cL
1gmuFFBQ1YEKusJ72eqWgmOL/GB/Zwgk1WeTtzhe7uK/HQdzL8s4Bdh/vcs+c8pH
pMU+AuxVxBuyhj5XXZpzXt8hoSI0VWL6NNK/AUx7d7hbEsAVB7do7LlqUyWm4GUl
-----END CERTIFICATE-----
28 changes: 28 additions & 0 deletions dig.key
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
-----BEGIN PRIVATE KEY-----
MIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQCqvzy6I/4sgmPL
LA78WVnmbO63PYS/E0EMNFP/OBi3/4ciXnsYzmXnLUgmvi/C5OJiJz8OKKC4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HmkgrZfOqlGPNH8UzAZjqO5wdj9vpi4eB/R8J+b
z0dECYfyR2ATDoYX32edaWnOUMI3kUPBAWQuNyfHJk87qFnmSx8+oWTnkQKBgQCf
VemdtmjOB2dmQ2uIHpmy68rPH5yHO9T2dBMLzwouG3Qtmaa3Pnh+SvdR8WeT0aWi
Q1Tz5iSbnAZ0J3ItDWH1YE2F+ocK1FHIfuIRcN0QCNscH44WH5SxH/4DB/38uXzr
FrzIjkqPg70tS4isLBABAFy75OYDVcstfZyGIaWvPQKBgQCTgp5CX8cGiFD5nJ3k
2qdWSOB/160MdV7EH/FUrzpx/S3mrB+JvlK0J9ei6NH+SUvB7pLHcjzBCHso8h62
nTzhHyYTo7mFbIOEFhU+Y386EMfIQSplM36a+ZxXC6r+Xz2QyWO4Yh6eI+eS050n
gK+RBgUP/CyZFqG4I5ucWATdFQ==
-----END PRIVATE KEY-----
10 changes: 8 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@dignetwork/dig-sdk",
"version": "0.0.1-alpha.134",
"version": "0.0.1-alpha.135",
"description": "",
"type": "commonjs",
"main": "./dist/index.js",
Expand Down Expand Up @@ -30,6 +30,7 @@
"archiver": "^7.0.1",
"axios": "^1.7.7",
"bip39": "^3.1.0",
"bottleneck": "^2.19.5",
"chia-bls": "^1.0.2",
"chia-config-loader": "^1.0.1",
"chia-root-resolver": "^1.0.0",
Expand Down
47 changes: 2 additions & 45 deletions src/DigNetwork/PropagationServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,6 @@ export class PropagationServer {
headers: {
"Content-Type": "application/json",
},
validateStatus: (status) => {
// Accept all status codes to handle them manually
return true;
},
};

// Data to send in the request (storeId and rootHash)
Expand All @@ -144,48 +140,9 @@ export class PropagationServer {

try {
const response = await axios.post(url, data, config);

if (response.status === 200) {
console.log(green(`✔ Peer was up to date: ${this.ipAddress}`));
return;
} else if (
response.status === 400 &&
response.data?.error?.includes("does not exist")
) {
console.log(
yellow(
`⚠ Peer ${this.ipAddress} does not have store ${this.storeId}. Notifying for update.`
)
);
// You can implement additional logic here if needed, such as retrying or logging
return;
} else {
console.error(
red(
`✖ Unexpected response from peer ${this.ipAddress}: ${response.status} ${response.statusText}`
)
);
throw new Error(
`Unexpected response: ${response.status} ${response.statusText}`
);
}
console.log(green(`✔ Successfully pinged peer: ${this.ipAddress}`));
return response.data;
} catch (error: any) {
if (error.response) {
// Server responded with a status other than 2xx
if (
error.response.status === 400 &&
error.response.data?.error?.includes("does not exist")
) {
console.log(
yellow(
`⚠ Peer ${this.ipAddress} does not have store ${this.storeId}. Notifying for update.`
)
);
// You can implement additional logic here if needed
return;
}
}

console.error(red(`✖ Failed to ping peer: ${this.ipAddress}`));
console.error(red(error.message));
throw error;
Expand Down
4 changes: 2 additions & 2 deletions src/blockchain/DataStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -298,13 +298,13 @@ export class DataStore {

public static getAllStores(): DataStore[] {
const storeFolders = fs.readdirSync(STORE_PATH);
const storIds = storeFolders.filter(
const storeIds = storeFolders.filter(
(folder) =>
/^[a-f0-9]{64}$/.test(folder) &&
fs.lstatSync(path.join(STORE_PATH, folder)).isDirectory()
);

return storIds.map((storeId) => DataStore.from(storeId));
return storeIds.map((storeId) => DataStore.from(storeId));
}

/**
Expand Down
Loading
Loading