import from matrix: fixup
Gitea Actions Demo / Explore-Gitea-Actions (push) Failing after 25s Details

This commit is contained in:
Ladd Hoffman 2024-04-29 17:51:51 -05:00
parent 337c4824fd
commit e709a1bc67
20 changed files with 63 additions and 53 deletions

View File

@ -1,11 +1,11 @@
{
"localhost": {
"DAO": "0x431c73b38B9eBe4a30C7A0ffa11188fa9429Bf38",
"Work1": "0x0173903444ed92F5e30f522d0f274162c57b4Cc0",
"Onboarding": "0x44df3b45C937c88267999a5f69D9BFBe83dEf447",
"Proposals": "0x663f119ffb7eD161A00C89c25046Afe8B40fff52",
"Rollup": "0xB61bB0defB5A0B59F0BAeBF2F4345d7c317c20B4",
"Work2": "0x4774670f82A590e7eD6072bd7098836B06FFd8ce"
"DAO": "0x87933c1e51FdF52C58ee54348a9372bbDeE9A8Dc",
"Work1": "0x215078c5cf21ffB79Ee14Cf09156B94a11b7340f",
"Onboarding": "0x3c2820D27e7470075d16856D7D555FD5011451Ec",
"Proposals": "0xCd5881DB1aa6b86283a9c5660FaB65C989cf2721",
"Rollup": "0x8611676563EBcd69dC52E5829bF2914A957398C3",
"Work2": "0xC6BF1b68311e891D2BF41E4A3CB350a403831Ccd"
},
"sepolia": {
"DAO": "0x8e5bd58B2ca8910C5F9be8de847d6883B15c60d2",

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -71,8 +71,9 @@ module.exports = async (req, res) => {
eventId,
};
// We can't sign it on behalf of the author, but we can sign it with our own key
const sender = wallet.getAddress();
const signature = await wallet.signMessage();
const sender = await wallet.getAddress();
const contentToVerify = `${content}\n\n${JSON.stringify(embeddedData, null, 2)}`;
const signature = await wallet.signMessage(contentToVerify);
const { hash } = await write({
sender, authors, citations, content, embeddedData, signature,

View File

@ -0,0 +1,3 @@
module.exports = {
start: () => {},
};

View File

@ -20,6 +20,9 @@ const write = async ({
const data = {
sender, authors, content, signature, embeddedData, citations,
};
// We omit citations from the hash in order to support forum graph import.
// When a post is imported, the hashes can be precomputed for cited posts,
// without traversing the graph infinitely to compute hashes along entire reference chain.
const hash = objectHash({
sender, authors, content, signature, embeddedData,
});

View File

@ -9,7 +9,11 @@ const verifySignature = ({
}
try {
const account = recoverPersonalSignature({ data: contentToVerify, signature });
const addresses = authors.concat(sender).map((author) => author.authorAddress.toLowerCase());
console.log({ sender, account, authors });
const addresses = authors
.map((author) => author.authorAddress)
.concat(sender ? [sender] : [])
.map((authorAddress) => authorAddress.toLowerCase());
if (!addresses.includes(account.toLowerCase())) {
console.log('error: signer is not among the authors or sender');
return false;

View File

@ -1,11 +1,11 @@
{
"localhost": {
"DAO": "0x431c73b38B9eBe4a30C7A0ffa11188fa9429Bf38",
"Work1": "0x0173903444ed92F5e30f522d0f274162c57b4Cc0",
"Onboarding": "0x44df3b45C937c88267999a5f69D9BFBe83dEf447",
"Proposals": "0x663f119ffb7eD161A00C89c25046Afe8B40fff52",
"Rollup": "0xB61bB0defB5A0B59F0BAeBF2F4345d7c317c20B4",
"Work2": "0x4774670f82A590e7eD6072bd7098836B06FFd8ce"
"DAO": "0x87933c1e51FdF52C58ee54348a9372bbDeE9A8Dc",
"Work1": "0x215078c5cf21ffB79Ee14Cf09156B94a11b7340f",
"Onboarding": "0x3c2820D27e7470075d16856D7D555FD5011451Ec",
"Proposals": "0xCd5881DB1aa6b86283a9c5660FaB65C989cf2721",
"Rollup": "0x8611676563EBcd69dC52E5829bF2914A957398C3",
"Work2": "0xC6BF1b68311e891D2BF41E4A3CB350a403831Ccd"
},
"sepolia": {
"DAO": "0x8e5bd58B2ca8910C5F9be8de847d6883B15c60d2",

View File

@ -1,11 +1,11 @@
{
"localhost": {
"DAO": "0x431c73b38B9eBe4a30C7A0ffa11188fa9429Bf38",
"Work1": "0x0173903444ed92F5e30f522d0f274162c57b4Cc0",
"Onboarding": "0x44df3b45C937c88267999a5f69D9BFBe83dEf447",
"Proposals": "0x663f119ffb7eD161A00C89c25046Afe8B40fff52",
"Rollup": "0xB61bB0defB5A0B59F0BAeBF2F4345d7c317c20B4",
"Work2": "0x4774670f82A590e7eD6072bd7098836B06FFd8ce"
"DAO": "0x87933c1e51FdF52C58ee54348a9372bbDeE9A8Dc",
"Work1": "0x215078c5cf21ffB79Ee14Cf09156B94a11b7340f",
"Onboarding": "0x3c2820D27e7470075d16856D7D555FD5011451Ec",
"Proposals": "0xCd5881DB1aa6b86283a9c5660FaB65C989cf2721",
"Rollup": "0x8611676563EBcd69dC52E5829bF2914A957398C3",
"Work2": "0xC6BF1b68311e891D2BF41E4A3CB350a403831Ccd"
},
"sepolia": {
"DAO": "0x8e5bd58B2ca8910C5F9be8de847d6883B15c60d2",

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -8,8 +8,9 @@ window.Buffer = Buffer;
class Post {
constructor({
authors, content, signature, hash, embeddedData, citations,
sender, authors, content, signature, hash, embeddedData, citations,
}) {
this.sender = sender;
this.authors = authors;
this.content = content;
this.signature = signature;
@ -22,12 +23,12 @@ class Post {
static async read(hash) {
const {
data: {
content, authors, signature, embeddedData, citations,
sender, authors, content, signature, embeddedData, citations,
},
} = await axios.get(`/api/read/${hash}`);
// Verify hash
const derivedHash = objectHash({
authors, content, signature, embeddedData,
sender, authors, content, signature, embeddedData,
});
if (hash !== derivedHash) {
throw new Error('Hash mismatch');
@ -45,16 +46,13 @@ class Post {
}
}
return new Post({
content, authors, signature, hash, embeddedData, citations,
sender, authors, content, signature, hash, embeddedData, citations,
});
}
// Include MetaMask signature
async sign(web3Provider, account) {
const author = this.authors?.find(({ authorAddress }) => authorAddress === account);
if (!author) {
throw new Error('Post must be signed by one of its authors');
}
this.sender = account;
let contentToSign = this.content;
if (this.embeddedData && Object.entries(this.embeddedData).length) {
contentToSign += `\n\n${JSON.stringify(this.embeddedData, null, 2)}`;
@ -70,6 +68,7 @@ class Post {
// Write to API
async write() {
const data = {
sender: this.sender,
authors: this.authors,
content: this.content,
signature: this.signature,